<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
    <title><fmt:message code="roleAuthorization.th.ViewDetails" /></title>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8 ? MYOA_CHARSET : htmlspecialchars($HTML_PAGE_CHARSET))?>" />
    <%--    <meta name="renderer" content="webkit">--%>
    <meta name="renderer" content="ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=0.3, user-scalable=0, minimum-scale=0, maximum-scale=5.0,user-scalable=yes">
    <link rel="stylesheet" type="text/css" href="../../css/easyui/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../css/easyui/icon.css">
    <link rel="stylesheet" type="text/css" href="../../css/workflow/m_reset.css">
    <link rel="stylesheet" type="text/css" href="../../css/workflow/work/new_work.css">
    <link rel="stylesheet" type="text/css" href="../../css/workflow/work/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../../lib/laydate.css"/>
    <link rel="stylesheet" href="../../lib/layui/layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="../../css/workflow/work/handle.css"/>
    <link rel="stylesheet" type="text/css" href="/css/dept/roleAuthorization.css"/>
    <script type="text/javascript" src="../../js/news/jquery-1.9.1.js"></script>
    <script src="../../js/workflow/work/ProjectControls.js"></script>
    <script src="/lib/qrcode.js"></script>
    <script src="../../js/base/base.js?20200116.1"></script>
    <script src="../../js/jquery/jquery.cookie.js"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script src="../../lib/layui/layui/layui.js"></script>
    <script type="text/javascript" src="../../js/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../js/easyui/easyui-lang-zh_CN.js"></script>
    <script src="/lib/ueditor/ueditor.config.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/ueditor/ueditor.all.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/ueditor/UEcontroller.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/workflow/work/Loadwebsign.js?20190926.1"></script>
    <script src="/js/workflow/work/websign_main.js?20190926.1"></script>
    <script src="/lib/img2blob/js/img2blob.js?201907311" type="text/javascript"></script>
    <script src="/js/workflow/work/calculateFormitem.js?20201016.1"></script>
    <script type="text/javascript" src="../../js/workflow/work/startScore.js"></script>
    <script src="/js/workflow/work/workform.js?20201028.1"></script>
    <script src="/js/base/workformbase.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script src="/lib/jquery.jqprint-0.3.js"></script>
    <script src="/lib/jquery-migrate-1.1.0.js"></script>
    <script src="/js/mustache.min.js"></script>
    <script type="text/javascript" src="/js/workflow/work/writeSign.js?20190926.1"></script>




    <!-- 金格签章 -->

    <%--    <link rel="stylesheet" href="../../lib/kinggrid/dialog/artDialog/ui-dialog.css">--%>
    <%--    <link rel="stylesheet" href="../../lib/kinggrid/core/kinggrid.plus.css">--%>

    <link rel="stylesheet" href="/css/workflow/work/workFormPreView.css?20200903.1">

    <%--    <script type="text/javascript" src="../../lib/kinggrid/core/kinggrid.min.js"></script>--%>
    <%--    <script type="text/javascript" src="../../lib/kinggrid/core/kinggrid.plus.min.js"></script>--%>
    <%--    <script type="text/javascript" src="../../lib/kinggrid/dialog/artDialog/dialog.js"></script>--%>

    <%--    <!-- html签章核心JS -->--%>
    <%--    <script type="text/javascript" src="../../lib/kinggrid/signature.min.js"></script>--%>
    <%--    <!-- PC端附加功能 -->--%>
    <%--    <script type="text/javascript" src="../../lib/kinggrid/signature.pc.min.js"></script>--%>
    <!-- 移动端端附加功能 -->
    <%--    <link rel="stylesheet" href="../../lib/kinggrid/core/kinggrid.plus.mobile.css">--%>
    <%--    <script type="text/javascript" src="../../lib/kinggrid/signature.mobile.min.js"></script>--%>

    <script type="text/javascript" src="/js/workflow/work/macroSign.js?20191115.1" ></script>
    <script type="text/javascript" src="/js/spirit/qwebchannel.js"></script>
    <script>
        var myBrowser = myBrowser();
        var url = location.href;
        if(myBrowser == 'IE8'&&location.href.indexOf('&ie_open=yes') > -1){
            url += '&ie_version=8';
            url= url.replace('IE=1&','').replace('&ie_open=yes','');
            location.href = url;
        }else{
            var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串,判断是否是pc客户端打开的qt浏览器
            if(userAgent.indexOf('QtWebEngine') > -1&&location.href.indexOf('&ie_open=yes') == -1){
                url += '&ie_open=yes&IE=1';

                window.open(url);
                window.close();
            }
        }
    </script>

    <script type="text/javascript" src="/js/workflow/work/newDataControl.js" ></script>

</head>

<body>
<input type="hidden" value="${sessionScope.module }" id="module">
<div style="height: 0px;"><object id="WebBrowser" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0" width="0" viewastext></object></div>
<div id="bodys" style="display: none">
    <div class="head">
        <div id="title" class="abs_left">
            <h1 class="num" ></h1>
            <h2 class="step"></h2>
            <div class="stepOne">
                <h2 class="step" ><input id="dyform" data-id="1" type="checkbox" checked="checked"><span class="steptext"><fmt:message code="workfolw.th.form" /></span></h2>
                <h2 class="step"><input id="dyfile" data-id="2" type="checkbox"  checked="checked"><span class="steptext"><fmt:message code="workflow.th.PublicAccessories" /></span></h2>
                <h2 class="step" ><input id="dysign" data-id="3" type="checkbox"  checked="checked"><span class="steptext"><fmt:message code="work.th.CountersignedArea" /></span></h2>
                <h2 class="step"><input id="dyflow" data-id="4" type="checkbox"  checked="checked"><span class="steptext"><fmt:message code="workflow.th.chart" /></span></h2>
                <h2 class="step"><input id="dyother" data-id="5" type="checkbox"  checked="checked"><span class="steptext">其他</span></h2>
                <h2 class="BigButtonCBox">
                    <input type="button" value="查看父流程表单" class="BigButtonC" title="查看父流程表单">
                </h2>
                <h2 class="BigSelectBox" style="margin-right: 20px;">
                    <select class="BigSelect" name="child_run" onchange="show_child(this.value,$(this))"><option value="" selected="">查看子流程表单</option></select>
                </h2>
            </div>
        </div>

        <div id="tab_t" class="abs_right">
            <span id="flowtype" class="flowtypetext"></span>
        </div>
        <div class="tabAB">
            <ul class="clearfix" style="display:none">
                <li class="fl active" data-id="1" ><fmt:message code="workflow.th.form" /></li>
                <li class="fl" data-id="2" ><fmt:message code="main.th.text" /></li>
            </ul>
        </div>
    </div>
    <div class="content" >
        <%-- <form action="/workflow/work/nextwork"   id="ajaxform">--%>
        <div class="cont" style="background: #fff" id="client">
            <p class="serialNumber"></p>
            <%--表单--%>
            <div class="cont_form" id="a2">

            </div>

            <%--公共附件--%>
            <div class="other_module_box theAttachment" id="files" style="margin: 0 auto;display: none;">
                <p style="font-size: 14pt;margin: 10px 0;">
                    <fmt:message code="workflow.th.PublicAccessories" />
                </p>
                <table  style="width: 100%;margin: 0 auto;table-layout: fixed" class="tr_td tr_tds">
                    <thead>
                    <tr>
                        <th class="th">
                            <fmt:message code="workflow.th.AttachmentName" />
                        </th>
                        <th class="th" style="width: 20%">
                            <fmt:message code="workflow.th.AttachmentSize" />
                        </th>
                        <%--  <th class="th">
                              <fmt:message code="notice.th.createTime" />
                          </th>--%>
                    </tr>
                    </thead>
                    <tbody>

                    </tbody>
                </table>
            </div>

            <!-- 关联流程工作 -->
            <div class="other_module_box connect_detail other_module" id="connectDetail" style="display: none;margin: 0 auto;">
                <p style="width: 100%; margin: 30px auto 10px; font-size: 14pt;">
                    相关流程
                </p>
                <table style="width: 100%;" class="tr_td">
                    <thead>
                    <tr>
                        <th class="th">
                            流程类型
                        </th>
                        <th class="th" style="width: 70%;">
                            流程名称
                        </th>
                    </tr>
                    </thead>
                    <tbody class="connect_detail_content other_module_tbody">

                    </tbody>
                </table>
            </div>
            
            <!-- 查阅情况 -->
            <div class="other_module_box other_module" id="readDetail" style="display: none;margin: 0 auto;">
                <p style="width: 100%; margin: 30px auto 10px; font-size: 14pt;">
                    查阅情况
                </p>
                <table style="width: 100%;" class="tr_td">
                    <thead>
                        <tr>
                            <th class="th" colspan="2">
                                已读人员
                            </th>
                            <th class="th" colspan="1" rowspan="2" style="width: 40%; border-left: 1px solid #ddd;">
                                未读人员
                            </th>
                        </tr>
                        <tr>
                            <th class="th" colspan="1">
                                姓名
                            </th>
                            <th class="th" rowspan="1">
                                已读时间
                            </th>
                        </tr>
                    </thead>
                    <tbody class="other_module_tbody read_detail_content">
        
                    </tbody>
                </table>
            </div>

            <!-- 交办详情 -->
            <div class="other_module_box" id="assignmentDetail" style="margin: 0 auto;overflow-x: hidden;">
                <div class="assignment_head" style="margin:0 auto;">
                    <span style="margin-left:-20px">交办详情</span>
                </div>
                <table id="assignmenttable" lay-filter="assignmenttable"></table>
            </div>

            <%--会签意见区--%>
            <div class="other_module_box steptextcheck" id="Opinion" style="display: none;margin: 0 auto;text-align:left;">
                <div class="assignment_head" style="margin:0 auto;text-align:left;width:100%;">
                    会签意见区
                </div>
                <table style="margin: 15px auto;width:100%;">
                    <tbody></tbody>
                </table>
            </div>

            <%--流程图--%>
            <div class="other_module_box steptextliucheng" id="process" style="display: none;margin: 0 auto;text-align:left">
                <%--<p style="width: 70%;margin: 0 auto;font-size: 14pt;margin-top: 20px;margin-left:22%">--%>
                <%--流程图--%>
                <%--</p>--%>
                <div class="assignment_head" style="width:100%;margin:0 auto;">
                    流程图
                </div>

                <table style="margin: 15px auto;table-layout: fixed;text-align: center" class="tr_td trtd_d">
                    <tbody>

                    </tbody>
                </table>
            </div>
            <div style="width: 100%;height: 49px;">

            </div>
        </div>


        <div class="officialDocument clearfix" style="display: none">
            <iframe id="zw" src="" frameborder="0" scrolling="yes" height="100%" width="100%" noresize="noresize" tid="2"></iframe>
        </div>
    </div>
    <div class="foot" style="background: #f8f8f8;height: 48px;border-top: 1px solid #9E9E9E;">
        <div class="foot_left">
        </div>
        <div class="foot_rig">
            <ul>
                <li class="rig_li more baocunfanhui"  id="more" style="position: relative">
                    <ul class="floatRight" style="position: absolute;display: none;background-color: #fff;top:-180px">
                        <li id="guidang" style="width: 100%!important;"><h1 class="rig_h1 rig_h1one" ><fmt:message code="workflow.th.File" /></h1></li>
                        <li id="daochu" style="width: 100%!important;"><h1 class="rig_h1 rig_h1one" ><fmt:message code="global.lang.report" /></h1></li>
                        <li id="mail" style="width: 100%!important;"><h1 class="rig_h1 rig_h1one" >内部邮件</h1></li>
                        <li id="notify_add" style="width: 100%!important;"><h1 class="rig_h1 rig_h1one" ><fmt:message code="adding.th.sort" /></h1></li>
                        <li id="shareSave" style="width: 100%!important;"><h1 class="rig_h1 rig_h1one" >转存</h1></li>
                        <li id="downloadFiles" style="width: 100%!important;"><h1 class="rig_h1 rig_h1one" >文件下载</h1></li>
                    </ul>

                    <h1 class="rig_h1 rig_h1one" ><fmt:message code="adding.th.more" /></h1></li>
                <%--<li class="rig_li bak1"><h1 class="rig_h1" id="actionOverflow">更多操作</h1></li>--%>
                <li class="bak5" ><h1  id="exportWORD">导出Word</h1></li>
                <li class="bak4" ><h1  id="exportPDF">导出PDF</h1></li>
                <li class="bak1" ><h1  id="print"><fmt:message code="global.lang.print" /></h1></li>
                <li class="bak3" ><h1  id="printPreView">打印预览</h1></li>
                <%--<li class="rig_li bak1"><h1 class="rig_h1" id="printPreView"><fmt:message code="workflow.th.allwork" /></h1></li>--%>
                <%--<li class="rig_li bak1"><h1 class="rig_h1" id="exportToWord"><fmt:message code="long.th.ExportWord" /></h1></li>--%>
                <%--<li class="rig_li bak1"><h1 class="rig_h1" id="exportToHtml"><fmt:message code="long.th.ExportHTML" /></h1></li>--%>
                <li class="bak2"><h1  id="closeWin"><fmt:message code="global.lang.close" /></h1></li>
                <li id="noticeBottom" style="width: 100px;color: #000;display: none"><h1 class="rig_h1" style="width: 82px;margin-left: 20px;">内部分发</h1></li>
            </ul>
        </div>
    </div>
</div>

<div id="share" style="display: none">
    <form action=""style="padding: 10px" method="post" name="form1"  action="">
        <span style="font-size: 16px">内容选择：</span>
        <input type="checkbox"  name="CHECK1" id="CHECK1" checked="true"> <span>表单</span>
        <input type="checkbox"  name="CHECK2" id="CHECK2" checked="true"> <span>公共附件</span>
        <input type="checkbox" name="CHECK3" id="CHECK3" checked="true"> <span>会签与点评</span>
        <input type="checkbox"name="CHECK4" id="CHECK4" checked="true"> <span>流程图</span>
        <input type="hidden" name="RUN_ID" value="625">
        <input type="hidden" name="FLOW_ID" value="126">
        <input type="hidden" name="PRCS_ID" value="4">
        <input type="hidden" name="FLOW_PRCS" value="4">
        <input type="hidden" name="FLOW_VIEW">
    </form>
</div>

<!-- 分发详情 -->
<div id="dispensemodal" style="display: none">
    <table id="dispensetable" lay-filter="dispensetable"></table>
</div>

<!-- 交办详情 -->
<script type="text/html" id="assignmentBar">
    {{#  if(d.handleStatus != 2 && d.handleUser == userId && globalData.flowProcesses){ }}
    <a class="layui-btn layui-btn-xs" lay-event="1">办理</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="2">交办</a>
    {{#  } }}
</script>

<!-- 联网查看签收情况 -->
<div id="dispensemodal2" style="display: none">
    <table id="dispensetable2" lay-filter="dispensetable2"></table>
</div>

<script type="text/html" id="dispensetable2toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="add">批量收回</button>
    </div>
</script>

<script type="text/html" id="dispensetable2Bar">
    {{#  if(d.receiveStatus != '已收回'){ }}
    <a class="layui-btn layui-btn-xs" lay-event="1">收回</a>
    {{#  } }}
</script>
    
    <script type="text/html" id="dispensetableBar">
    {{#  if(d.receiveStatus == '0'){ }}
    <a class="layui-btn layui-btn-xs" lay-event="1">收回</a>
    {{#  } }}
</script>

<%--工作办理--%>
<div id="workDone" style="display: none;padding: 10px 30px 10px 0;">
    <form class="layui-form" action="">
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label" style="margin-top:30px;">办理汇报：</label>
            <div class="layui-input-block">
                <textarea id="neirong1" name="desc" placeholder=" " class="layui-textarea"></textarea>
            </div>
        </div>

        <div class="layui-upload">
            <div id="demo3" style="padding-left: 110px;"></div>
            <label class="layui-form-label" style="margin-left: -22px;">附件：</label>
            <button type="button" class="layui-btn layui-btn-primary layui-btn layui-btn-sm" id="test4" style="border: 0px;color:#1E9FFF;margin-left:14px"><img style="margin-right:5px;" src="/img/icon_uplod.png"><i class="layui-icon" style="display: none;"></i>附件上传</button>

        </div>

        <div class="layui-form-item " >
            <label class="layui-form-label" style="margin-left: -22px;">提醒：</label>
            <div class="layui-input-block" >
                <input   type="checkbox"  name="smstype" value="5" title="发送事务提醒消息" lay-skin="primary" checked>
                <input  type="checkbox"  name="smstype" value="6" title="使用手机短信提醒" lay-skin="primary">
            </div>
        </div>
    </form>

</div>

<%--工作交办--%>
<div id="work" style="display: none;padding: 10px 30px 10px 10px;">
    <form class="layui-form" action="">
<%--        <div class="layui-form-item layui-form-text">--%>
<%--            <label class="layui-form-label" style="margin-top:30px;">交办内容：</label>--%>
<%--            <div class="layui-input-block">--%>
<%--                <textarea id="neirong" name="desc" style="resize: none;display: inline-block;width: 300px;" placeholder=" " class="layui-textarea"></textarea>--%>
<%--                <div style="display: inline-block;">--%>
<%--                    <a href="javascript:;" id="assignmentSign" style="color: blue;font-size: 14px;">添加常用意见</a>--%>
<%--                </div>--%>
<%--            </div>--%>
<%--        </div>--%>
        <div class="layui-form-item ">
            <label class="layui-form-label">办理人：</label>
            <div class="layui-input-block">
                <textarea id="chargePerson" user_id="" name="title" style="width: 300px;background-color: #ccc;min-height: 50px;resize: none;display: inline-block;" disabled readonly lay-verify="required" placeholder=" " class="layui-textarea"></textarea>
                <div style="display: inline-block;">
                    <a href="javascript:;" id="userAdd" style="color: blue;font-size: 14px;">添加</a>
                    <a href="javascript:;" id="delUser" style="color: red;font-size: 14px">清除</a>
                </div>
            </div>
        </div>

<%--        <div class="layui-form-item " style="font-size: 13px">--%>
<%--            <label class="layui-form-label laclass" style="width: auto;">是否允许填写会签意见：</label>--%>
<%--            <input id="yesr"   type="radio" name="opinionType" title="是"   ><input id="nor"   title="否" type="radio" name="opinionType"  value="1"  >--%>
<%--        </div>--%>

        <div class="layui-upload">
            <div id="demo2" style="padding-left: 110px;"></div>
            <label class="layui-form-label">附件：</label>
            <button type="button" class="layui-btn layui-btn-primary layui-btn layui-btn-sm" id="test3" style="border: 0px;color:#1E9FFF;padding: 0;"><img style="margin-right:5px;" src="/img/icon_uplod.png"><i class="layui-icon" style="display: none;"></i>附件上传</button>
        </div>

        <div class="layui-form-item " >
            <label class="layui-form-label">提醒：</label>
            <div class="layui-input-block" >
                <input   type="checkbox"  name="smstype" value="5" title="发送事务提醒消息"  lay-skin="primary" checked>
                <input  type="checkbox"  name="smstype" value="6" title="使用手机短信提醒" lay-skin="primary">
            </div>
        </div>

    </form>


</div>

<script>
    var userId = $.cookie('userId');
    var globalData = {};
    $('.steptextliucheng').hide();
    $('.steptextcheck').hide();
    $(window).resize(function () {
        var  height=document.documentElement.clientHeight;
        $('.officialDocument').css('height',height-98);
    })

    $('#print').click(function(){
        if($('.splitTab').length != 0){
            $('.splitTab').hide();
        }
        $('.head').hide();
        $('.foot').hide();
        $("#client .serialNumber").text('');
        var text = $('.num').text();
        text = text.replace(/\./g, "");
        $('title').html(text);
        $('table tr td').css({
            'word-break': 'break-all',
            'word-wrap': 'break-word'
        })
        /*************设置表单下列表与表单宽度一致START***************/
        var formWidth = $('.cont_form').find('.firstRow').parents('table').width();
        if(formWidth==0||formWidth==undefined){
            $('.other_module_box').width(1200);
            formWidth = 1200;
        }else{
            $('.other_module_box').width(formWidth);
        }
        var screenwidth = 1200;
        var tdwidth1 = screenwidth  * 0.20 +'px';
        var tdwidth2 = screenwidth  * 0.30 +'px';
        var tdwidth3 = screenwidth * 0.5 +'px';
        var tdwidth11 = screenwidth  * 0.08 +'px';
        var tdwidth22 = screenwidth  * 0.2 +'px';
        var tdwidth33 = screenwidth * 0.72 +'px';
        $('.trtd_d tr.this').eq(0).find('td').eq(0).css('width',tdwidth11);
        $('.trtd_d tr.this').eq(0).find('td').eq(1).css('width',tdwidth22);
        $('.trtd_d tr.this').eq(0).find('td').eq(2).css('width',tdwidth33)

        /*************设置表单下列表与表单宽度一致END***************/
        window.print();
        $('.other_module_box').width(1200);
        $('.trtd_d tr.this').eq(0).find('td').eq(0).css('width',tdwidth1);
        $('.trtd_d tr.this').eq(0).find('td').eq(1).css('width',tdwidth2);
        $('.trtd_d tr.this').eq(0).find('td').eq(2).css('width',tdwidth3)

        if($('.splitTab').length != 0){
            $('.splitTab').show();
        }
        $('.head').show();
        $('.foot').show();
        $("#client .serialNumber").text('');
        var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串,判断是否是pc客户端打开的qt浏览器，因为无法打印做一个兼容处理
        if(userAgent.indexOf('QtWebEngine') > -1){
            var url = window.location.href;
            var printType= '';
            if($('#dyform').is(':checked')){
                printType += '1,'
            }
            if($('#dyfile').is(':checked')){
                printType += '2,'
            }
            if($('#dysign').is(':checked')){
                printType += '3,'
            }
            if($('#dyflow').is(':checked')){
                printType += '4,'
            }
            url += '&ie_open=yes&printBtn=1&printType='+printType;
            window.open(url);
            window.close();
        }

    });

    $('#title input[type=checkbox]').click(function () {
        if($(this).is(':checked')){
            if($(this).attr('data-id')==1){
                $('#a2').show()
            }else if($(this).attr('data-id')==2){
                $('.theAttachment').show()
            }else if($(this).attr('data-id')==3){
                $('.steptextcheck').show()
            }else if($(this).attr('data-id')==4){
                $('.steptextliucheng').show()
            } else if ($(this).attr('data-id')==5){
                if ($('.connect_detail_content').children().length > 0) {
                    $('#connectDetail').show();
                }
                if ($('.read_detail_content').children().length > 0) {
                    $('#readDetail').show();
                }
                if ($('#assignmentDetail').find('.layui-none').length == 0) {
                    $('#assignmentDetail').show();
                }
            }
        }else {
            if($(this).attr('data-id')==1){
                $('#a2').hide()
            }else if($(this).attr('data-id')==2){
                $('.theAttachment').hide()
            }else if($(this).attr('data-id')==3){
                $('.steptextcheck').hide()
            }else if($(this).attr('data-id')==4){
                $('.steptextliucheng').hide()
            } else if ($(this).attr('data-id')==5){
                $('#connectDetail').hide();
                $('#readDetail').hide();
                $('#assignmentDetail').hide();
            }
        }
    });

    $('#exportToWord').click(function () {
        $.layerMsg({content:'<fmt:message code="lang.th.Upcoming" />',icon:6},function(){

        });
    });

    $('#exportToHtml').click(function () {
        $.layerMsg({content:'<fmt:message code="lang.th.Upcoming" />',icon:6},function(){

        });
    });

    $('#closeWin').click(function () {
        window.close();
    });

</script>
</body>
</html>
<script>

    function openFiledaochu(text) {
        var indexdc = layer.load();
        $.ajax({
            type:'post',
            url:'/rmsFile/createFormHtml',
            data:{
                htmlContent:text,
                typeFlag:2,
            },
            async:false,
            success:function(json){
                if(json.flag){
                    layer.close(indexdc);
                    window.open('/download?'+encodeURI(json.object.attUrl));
                }
            }
        })
    };

    function openFile(a) {
        $.post('/rmsFile/createFormHtml',{htmlContent:a,typeFlag:1},function (json) {
            if(json.flag){
                $('#ifDiv').remove();
                window.open('/rmsFile/toAdd?aid='+json.object.aid+'&runId='+runId);
            }
        },'json')
    };

    function fujian() {
        if($('#dyfile').is(':checked')){
            $('.theAttachment').show()

        } else{
            $('.theAttachment').hide()
        }
    };

    function huiqian() {
        if($('#dysign').is(':checked')){
            $('.steptextcheck').show()

        } else{
            $('.steptextcheck').hide()
        }

    };

    function liucheng() {
        if($('#dyflow').is(':checked')){
            $('.steptextliucheng').show()

        } else{
            $('.steptextliucheng').hide()
        }

    };
    //查看父流程表单功能
    function form_view(runnid,flowid){
        window.open('/workflow/work/workformPreView?flowId='+ flowid +'&prcsId=&flowStep=&runId='+runnid);
    };
    //查看子流程表单功能
    function show_child(value,e){
        var runnid = value.split(':')[0];
        var flowid = value.split(':')[1];
        window.open('/workflow/work/workformPreView?flowId='+ flowid +'&prcsId=&flowStep=&runId='+runnid);
    };

    function sortNumber(a,b) {
        return a - b
    };

    function clickDownload(e) {
        var url = e.attr('url');
        var file = url.split('ATTACHMENT_NAME=')[1]

        if(file.indexOf('&')>=0){
            file = file.split('&')[1]
            var attUrl = url.split('ATTACHMENT_NAME=')[0]+'ATTACHMENT_NAME=&'+file;
        }else{
            file = ''
            var attUrl = url.split('ATTACHMENT_NAME=')[0]+'ATTACHMENT_NAME=';
        }

        window.open(attUrl);
    };
    //更多操作按钮，转存-选择下一步
    function historyDown() {
        $('.shareDivTitle').text('请选择转存目录：');
        $('.shareDivCheck').hide();
        $('.shareDivDown').hide();
        $('.shareDivChoose').show();
        $('.TableData').show();
        $('.shareDivUp').show();
        reloadTree($('input[name=shareDivCHECK]:checked').val());
    };
    //更多操作按钮，转存-选择上一步
    function historyUP() {
        $('.shareDivTitle').text('请选择转存位置：');
        $('.shareDivCheck').show();
        $('.shareDivDown').show();
        $('.shareDivChoose').hide();
        $('.TableData').hide();
        $('.shareDivUp').hide();
    }
    //更多操作按钮，转存-选择转存
    function turnFun() {
        var fileName = $('input[name=SUBJECT]').val()||'';
        var htmlContent = document.getElementById("a2").outerHTML+document.getElementById("process").outerHTML;
        var sortId = $('.tree-node-selected').attr('node-id')||0;
        var formAttachment = '';
        for(var i=0;i<$('.fileupload_data').length;i++){
            formAttachment += $('.fileupload_data').eq(i).attr('atturl')+'*';
        }
        for(var i=0;i<$('.imgupload_data').length;i++){
            formAttachment += $('.imgupload_data').eq(i).attr('src').split('/xs?')[1]+'*';
        }

        $.ajax({
            type:'post',
            url:'/flowUtil/saveToFile',
            data:{
                runId:runId,
                fileName:fileName,
                htmlContent:htmlContent,
                sortId:sortId,
                formAttachment:formAttachment
            },
            success:function(json){
                if(json.flag){
                    $.layerMsg({content:'转存成功！',icon:1},function(){

                    })
                }else{
                    $.layerMsg({content:'转存失败！',icon:2},function(){

                    });
                }
            }
        })
    }
    var index = true;
    var Height=$('body').height()-2;
    $('.cabinet_left').height(Height);
    function reloadTree1(fn) {
        $('#li_parent').tree({
            url: '/newFilePub/getNewAllPrivateFile?sortId=0',
            animate:true,
            loadFilter: function(rows){
                var arr = convert(rows.datas);
                return arr;
            },
            onLoadSuccess: function (row, data) {
                for(var i=0;i<data.length;i++){
                    var node = $("#li_parent").tree("find",data[i].id);//找到id对应的节点
                    $(node.target).attr("title",data[i].text);//.target得到dom对象，设置title
                    if(data[i].children!=undefined){
                        buildNode(data[i].children)
                    }
                }
            },
            onClick:function(node){
                $('.spanFolder').html(node.text);
                $('.spanFolder').attr('data-id',node.id);
                $('.spanFolder').attr('title',node.text);
                $('#noFile').hide();
                $('.details').hide();
                $('.queryDetail').hide();
                $('.mainContent').show();
                $('.editAddFolder').hide();
                $(this).tree(node.state === 'closed' ? 'expand' : 'collapse', node.target);
                node.state = node.state === 'closed' ? 'open' : 'closed';
            },
            onBeforeExpand:function(node,param){
                $('#li_parent').tree('options').url = '/newFilePub/getNewAllPrivateFile?sortId='+node.id;// change the url
            }

        });
    }
    function reloadTree(type){
        if(type != 'person'){
            $('#fileTree').hide()
            $('#li_parent').show()

            reloadTree1(function(){
                var id = location.href.split('?')[1]||'';
                if(id != ''){
                    if(id.indexOf('search=') > -1){
                        subject='';
                        sort_no='';
                        creaters='';
                        keyword1='';
                        keyword2='';
                        keyword3='';
                        attScript='';
                        attName='';
                        attContain='';
                        begainTime='';
                        endTime='';
                        contentId=id.split('search=')[1];
                        queryAllData('');
                        $('.queryDetail').show().siblings().hide();
                    }else{
                        if($('.tree-node-selected').attr('node-id') != id){
                            $('.tree-node[node-id='+ id +']').click();
                        }
                        $('.tree-node[node-id='+ id +']').next().show();
                    }
                }
            });
        }else {
            $('#li_parent').hide()
            $('#fileTree').show()
            $('#fileTree').tree({
                url: '/newFilePri/getPriFileSort',
                animate: false,
                lines: false,
                loadFilter: function (rows) {
                    return convert1(rows.datas);
                },
                onClick: function (node) {
                    $('.spanFolder').html(node.text);
                    $('#noFile').hide();
                    $('.details').hide();
                    $('.queryDetail').hide();
                    $('.mainContent').show();
                    if(node.attributes == '0'){
                        $('#noJurisdiction').show();
                        $('.mainContent').hide();
                        $('#noFile').hide();
                        $('.details').hide();
                        $('.queryDetail').hide();
                        $('.newAddFolder').hide();
                        $('.editAddFolder').hide();
                    }else {
                        $('.mainContent').show();
                        $('#noJurisdiction').hide();
                        $('#noFile').hide();
                        $('.details').hide();
                        $('.queryDetail').hide();
                        $('.newAddFolder').hide();
                        $('.editAddFolder').hide();
                    }
                    init(node.id,node.attributes.SIGN_USER);
                    $('input[name="sortTxt"]').val('');
                    $('input[name="folderId"]').val('');
                    $('input[name="paid"]').val('');
                },
            });
        }
    }
    $('.w').on('click','.TITLE',function(){
        var that=$(this);
        var idT=$(this).parents('tr').attr('contentId');
        var sortId=$(this).parents('tr').attr('sortId');
        var dataIsRead=$(this).parents('tr').attr('data-isread');
        var deleteNum=$('input[name="deleteQuanxian"]').val();
        var exportNum=$('input[name="exportQuanxian"]').val();
        var editNum=$('input[name="editQuanxian"]').val();
        var riderNum=$('input[name="qianyueQuanxian"]').val();
        var reviewNum=$('input[name="reviewQuanxian"]').val()
        if(dataIsRead == '0'){
            $.ajax({
                type:'post',
                url:'/newFileContent/readFile',
                dataType:'json',
                data:{'contentId':idT},
                success:function(res){
                    if(res.flag){
                        that.siblings('img').remove();
                    }else{
                        $.layerMsg({content:'签阅失败！',icon:2});
                    }
                }
            })
        }
        $(this).children('img').hide();
        $.popWindow('/newFilePub/fileDetail?contentId='+idT+'&sortId='+sortId+'&deleteNum='+deleteNum+'&exportNum='+exportNum+'&editNum='+editNum+'&riderNum='+riderNum+'&reviewNum='+reviewNum,'<fmt:message code="file.th.detail"/>','100','150','1000px','500px');

    })
    //编辑点击事件
    $('.w').on('click','.editBtn',function(){
        var idT=$(this).parents('tr').attr('contentId');
        var sortId=$(this).parents('tr').attr('sortId');
        var contype=$(this).parents('tr').attr('conType');
        var idea=$('input[name="folderId"]').attr('ireader');
        $.popWindow('/newFilePub/newFiles?contentId='+idT+'&sortId='+sortId+'&contype='+contype+'&idea='+idea+'&ie_open=yes','<fmt:message code="global.lang.edit"/>','0','0','1500px','800px');
    })

    $(function(){
        // 查询提醒权限
        $.ajax({
            type:'get',
            url:'/smsRemind/getRemindFlag',
            dataType:'json',
            data:{
                type:16
            },
            success:function (res) {
                if(res.flag){
                    if(res.obj.length>0){
                        var data = res.obj[0];
                        // 是否默认发送
                        if(data.isRemind=='0'){
                            $('.remindCheck').prop("checked", false);
                        }else if(data.isRemind=='1'){
                            $('.remindCheck').prop("checked", true);
                        }
                        // 是否手机短信默认提醒
                        if(data.isIphone=='0'){
                            $('.smsDefault').prop("checked", false);
                        } else if (data.isIphone=='1'){
                            $('.smsDefault').prop("checked", true);
                        }
                        // 是否允许发送事务提醒
                        if(data.isCan=='0'){
                            $('.remindCheck').prop("checked", false);
                            $('.smsDefault').prop("checked", false);
                            $('.remindCheck').parent('div').hide();
                        }

                    }
                }
            }
        })
        var index = true;
        reloadTree(function(){
            var id = location.href.split('?')[1]||'';
            if(id != ''){
                if(id.indexOf('search=') > -1){
                    subject='';
                    sort_no='';
                    creaters='';
                    keyword1='';
                    keyword2='';
                    keyword3='';
                    attScript='';
                    attName='';
                    attContain='';
                    begainTime='';
                    endTime='';
                    contentId=id.split('search=')[1];
                    queryAllData('');
                    $('.queryDetail').show().siblings().hide();
                }else{
                    if($('.tree-node-selected').attr('node-id') != id){
                        $('.tree-node[node-id='+ id +']').click();
                    }
                    $('.tree-node[node-id='+ id +']').next().show();
                }
            }
        });
        var Height=$('body').height()-2;
        $('.cabinet_left').height(Height);

        $('#contentAdd').click(function(){
            var sortId=$('input[name="folderId"]').val();
            var sortText=$('input[name="sortTxt"]').val();
            var idea=$('input[name="folderId"]').attr('ireader');
            $.popWindow('/newFilePub/newFiles?sortId='+sortId+'&text='+encodeURI(sortText)+'&idea='+idea+'&ie_open=yes','<fmt:message code="global.lang.new"/>','100','300','960px','700px');
        })

        //全选点击事件
        $('#checkedAll').click(function(){
            var state =$(this).prop("checked");
            if(state==true){
                $(this).prop("checked",true);
                $(".checkChild").prop("checked",true);
                $(".contentTr").addClass('bgcolor');
                $('#singReading').removeClass('addBackground');
                $('#copy').removeClass('copyfile');
                $('#shear').removeClass('copyfile');
                $('#paste').removeClass('copyfile');
                $('#deletebtn').removeClass('addBackground');
            }else{
                $(this).prop("checked",false);
                $(".checkChild").prop("checked",false);;
                $('.contentTr').removeClass('bgcolor');
                $('#singReading').addClass('addBackground');
                $('#copy').addClass('copyfile');
                $('#shear').addClass('copyfile');
                $('#paste').addClass('copyfile');
                $('#deletebtn').addClass('addBackground');
            }
        })
        $('#checkedAlls').click(function(){
            var state =$(this).prop("checked");
            if(state==true){
                $(this).prop("checked",true);
                $(".checkChildren").prop("checked",true);
                $(".contentTrs").addClass('bgcolor');
                $('#queryDelete').removeClass('addBackground');

            }else{
                $(this).prop("checked",false);
                $(".checkChildren").prop("checked",false);;
                $('.contentTrs').removeClass('bgcolor')
                $('#queryDelete').addClass('addBackground');
            }
        })
        $('#checkedAllY').click(function(){
            var state =$(this).prop("checked");
            if(state==true){
                $(this).prop("checked",true);
                $(".checkChildren").prop("checked",true);
                $(".contentT").addClass('bgcolor');
                $('#deleteAll').removeClass('addBackground');
            }else{
                $(this).prop("checked",false);
                $(".checkChildren").prop("checked",false);;
                $('.contentT').removeClass('bgcolor');
                $('#deleteAll').addClass('addBackground');
            }
        })
        //删除点击事件
        $('#deletebtn').click(function(){
            if($('#deletebtn').hasClass('addBackground')){
                return false
            }
            //var TYPE=$('.w .trBtn').attr('TYPE');
            var id=$('.w .contentTr').attr('sortId');
            var idea=$('input[name="folderId"]').attr('ireader');
            var fileId=[];
            $(".checkChild:checkbox:checked").each(function(){
                var conId=$(this).attr("conId")
                fileId.push(conId);
            })
            if(fileId == ''){
                $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:2});
            }else{
                dataDelete(fileId,id,idea)
                $('#paste').addClass('addBackground');
            }
        })
        //查询列表删除事件
        $('#queryDelete').click(function(){
            if($('#queryDelete').hasClass('addBackground')){
                return false
            }
            var sortId=$('.w .contentTr').attr('sortId');
            var userId=$('#userDuser').attr('user_id');
            var fileId=[];
            $(".checkChildren:checkbox:checked").each(function(){
                var conId=$(this).attr("conId")
                fileId.push(conId);
            })
            if(fileId == ''){
                $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:2});
            }else{
                $('.details').show().siblings().hide();
                dataDeleteOne(fileId,sortId,userId)
            }
        })
        //全局搜索列表删除事件
        $('#deleteAll').click(function(){
            if($('#deleteAll').hasClass('addBackground')){
                return false
            }
            var userId=$('#userDuser').attr('user_id');
            var fileId=[];
            $(".checkChildren:checkbox:checked").each(function(){
                var conId=$(this).attr("conId")
                fileId.push(conId);
            })
            if(fileId == ''){
                $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:2});
            }else{
                $('.queryDetail').show().siblings().hide();
                dataDeleteAll(fileId,userId)
            }
        })
        //文件详情点击事件
        $('.w').on('click','.TITLE',function(){
            var that=$(this);
            var idT=$(this).parents('tr').attr('contentId');
            var sortId=$(this).parents('tr').attr('sortId');
            var dataIsRead=$(this).parents('tr').attr('data-isread');
            var deleteNum=$('input[name="deleteQuanxian"]').val();
            var exportNum=$('input[name="exportQuanxian"]').val();
            var editNum=$('input[name="editQuanxian"]').val();
            var riderNum=$('input[name="qianyueQuanxian"]').val();
            var reviewNum=$('input[name="reviewQuanxian"]').val()
            if(dataIsRead == '0'){
                $.ajax({
                    type:'post',
                    url:'/newFileContent/readFile',
                    dataType:'json',
                    data:{'contentId':idT},
                    success:function(res){
                        if(res.flag){
                            that.siblings('img').remove();
                        }else{
                            $.layerMsg({content:'签阅失败！',icon:2});
                        }
                    }
                })
            }
            $(this).children('img').hide();
            $.popWindow('/newFilePub/fileDetail?contentId='+idT+'&sortId='+sortId+'&deleteNum='+deleteNum+'&exportNum='+exportNum+'&editNum='+editNum+'&riderNum='+riderNum+'&reviewNum='+reviewNum,'<fmt:message code="file.th.detail"/>','100','150','1000px','500px');

        })
        //编辑点击事件
        $('.w').on('click','.editBtn',function(){
            var idT=$(this).parents('tr').attr('contentId');
            var sortId=$(this).parents('tr').attr('sortId');
            var contype=$(this).parents('tr').attr('conType');
            var idea=$('input[name="folderId"]').attr('ireader');
            $.popWindow('/newFilePub/newFiles?contentId='+idT+'&sortId='+sortId+'&contype='+contype+'&idea='+idea+'&ie_open=yes','<fmt:message code="global.lang.edit"/>','0','0','1500px','800px');
        })
        //签阅情况点击事件
        $('#file_Tachr').on('click','.signReading',function(){
            var idT=$(this).parents('tr').attr('contentId');
            $.popWindow('/newFilePub/signReading?contentId='+idT,'<fmt:message code="global.lang.edit"/>','50','100','1000px','700px');
        })

        //查询签阅情况点击事件
        $('#file_Tach').on('click','.signReading',function(){
            var idT=$(this).parents('tr').attr('contentId');
            $.popWindow('/newFilePub/signReading?contentId='+idT,'<fmt:message code="global.lang.edit"/>','50','100','1000px','700px');
        })
        //全局查询签阅情况点击事件
        $('#file_Tachrs').on('click','.signReading',function(){
            var idT=$(this).parents('tr').attr('contentId');
            $.popWindow('/newFilePub/signReading?contentId='+idT,'<fmt:message code="global.lang.edit"/>','50','100','1000px','700px');
        })

        //弹出一个页面层，查询点击事件
        $('.SEARCH').on('click', function(event){
            event.stopPropagation();
            var sortId=$('.contentTr').attr('sortId');
            var idea=$('input[name="folderId"]').attr('ireader');
            layer.open({
                type: 1,
                title:['<fmt:message code="global.lang.query"/>', 'background-color:#2b7fe0;color:#fff;'],
                area: ['700px', '460px'],
                shadeClose: true, //点击遮罩关闭
                btn: ['<fmt:message code="global.lang.query"/>', '<fmt:message code="global.lang.close"/>'],
                content: '<table cellspacing="0" cellpadding="0" class="tab" style="border-collapse:collapse;background-color: #fff;width: 98%;">' +
                    '<tr><td><fmt:message code="file.th.TitleContainsText"/>：</td><td><input type="text" style="width: 150px;" name="subjectName" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.Sort"/>：</td><td><input type="text" style="width: 150px;" name="contentNo" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.builder"/>：</td><td><div class="inPole"><textarea name="txt" id="userDuser" user_id="id" value="admin" disabled style="min-width: 300px;min-height:50px;"></textarea><span class="add_img" style="margin-left: 10px"><a href="javascript:;" id="selectUser" class="Add "><fmt:message code="global.lang.add"/></a></span></div></td></tr>'+
                    '<tr><td><fmt:message code="file.th.Keywords1"/>：</td><td><input type="text" style="width: 150px;" name="contentValue1" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.keyword2"/>：</td><td><input type="text" style="width: 150px;" name="contentValue2" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.keyword3"/>：</td><td><input type="text" style="width: 150px;" name="contentValue3" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.text"/>：</td><td><input type="text" style="width: 150px;" name="atiachmentDesc" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.fileName"/>：</td><td><input type="text" style="width: 150px;" name="atiachmentName" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.containsText"/>：</td><td><input type="text" style="width: 150px;" name="atiachmentCont" class="inputTd" value="" /><span style="margin-left: 10px;color:#999;font-size:9pt;"><fmt:message code="file.th.Only"/></span></td></tr>'+
                    '<tr><td><fmt:message code="global.lang.date"/>：</td><td><input type="text" style="width: 150px;" name="crStartDate" id="start" class="inputTd" value="" onclick="laydate(start)" /><span style="font-size:9pt;margin:0 5px;"><fmt:message code="global.lang.to"/></span><input type="text" style="width: 150px;" name="crEndDate" id="end" class="inputTd" value="" onclick="laydate(end)" /></td></tr>'+
                    '</table>',
                yes:function(index){
                    var userId=$('#userDuser').attr('user_id');
                    if(userId=='id'){
                        userId='';
                    }
                    subjectName=$('input[name="subjectName"]').val();
                    contentNo=$('input[name="contentNo"]').val()
                    createrd=$('#userDuser').attr('user_id');
                    contentValue1=$('input[name="contentValue1"]').val()
                    contentValue2=$('input[name="contentValue2"]').val()
                    contentValue3=$('input[name="contentValue3"]').val()
                    atiachmentDesc=$('input[name="atiachmentDesc"]').val()
                    atiachmentName=$('input[name="atiachmentName"]').val()
                    atiachmentCont=$('input[name="atiachmentCont"]').val()
                    crStartDate=$('input[name="crStartDate"]').val()
                    crEndDate=$('input[name="crEndDate"]').val()
                    queryOneData(sortId,userId,idea);
                    layer.close(index);
                    $('.mainContent').hide();
                    $('.details').show();
                },
            });
            $('#selectUser').click(function(){
                user_id='userDuser';
                $.popWindow("../common/selectUser");
            })

        });

        //点击全局搜索按钮
        $('#overall').on('click', function(event){
            event.stopPropagation();
            var sortId=$('.contentTr').attr('sortId');
            layer.open({
                type: 1,
                title:['<fmt:message code="Email.th.global"/>', 'background-color:#2b7fe0;color:#fff;'],
                area: ['600px', '460px'],
                shadeClose: true, //点击遮罩关闭
                btn: ['<fmt:message code="global.lang.query"/>', '<fmt:message code="global.lang.close"/>'],
                content: '<table cellspacing="0" cellpadding="0" class="tab" style="border-collapse:collapse;background-color: #fff;width: 94%;">' +
                    '<tr><td><fmt:message code="file.th.TitleContainsText"/>：</td><td><input type="text" style="width: 150px;" name="subject" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.Sort"/>：</td><td><input type="text" style="width: 150px;" name="sort_no" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.builder"/>：</td><td><div class="inPole"><textarea name="txt" id="userDuser" user_id="id" value="admin" disabled style="min-width: 300px;min-height:50px;"></textarea><span class="add_img" style="margin-left: 10px"><a href="javascript:;" id="selectUser" class="Add "><fmt:message code="global.lang.add"/></a></span></div></td></tr>'+
                    '<tr><td><fmt:message code="file.th.Keywords1"/>：</td><td><input type="text" style="width: 150px;" name="keyword1" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.keyword2"/>：</td><td><input type="text" style="width: 150px;" name="keyword2" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.keyword3"/>：</td><td><input type="text" style="width: 150px;" name="keyword3" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.text"/>：</td><td><input type="text" style="width: 150px;" name="attScript" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.fileName"/>：</td><td><input type="text" style="width: 150px;" name="attName" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.containsText"/>：</td><td><input type="text" style="width: 150px;" name="attContain" class="inputTd" value="" /><span style="margin-left: 10px;color:#999;font-size:9pt;"><fmt:message code="file.th.Only"/></span></td></tr>'+
                    '<tr><td><fmt:message code="global.lang.date"/>：</td><td><input type="text" style="width: 150px;" name="begainTime" id="start" class="inputTd" value="" onclick="laydate(start)" /><span style="font-size:9pt;margin:0 5px;"><fmt:message code="global.lang.to"/></span><input type="text" style="width: 150px;" name="endTime" id="end" class="inputTd" value="" onclick="laydate(end)" /></td></tr>'+
                    '</table>',
                success:function(){

                },
                yes:function(index){
                    var userId=$('#userDuser').attr('user_id');
                    if(userId=='id'){
                        userId='';
                    }
                    subject=$('input[name="subject"]').val();
                    sort_no=$('input[name="sort_no"]').val()
                    creaters=$('#userDuser').attr('user_id');
                    keyword1=$('input[name="keyword1"]').val()
                    keyword2=$('input[name="keyword2"]').val()
                    keyword3=$('input[name="keyword3"]').val()
                    attScript=$('input[name="attScript"]').val()
                    attName=$('input[name="attName"]').val()
                    attContain=$('input[name="attContain"]').val()
                    begainTime=$('input[name="begainTime"]').val()
                    endTime=$('input[name="endTime"]').val();
                    sortId='';
                    contentId='';
                    queryAllData(userId);
                    layer.close(index);
                    $('.mainContent').hide();
                    $('.queryDetail').show();
                },
            });
            $('#selectUser').click(function(){
                user_id='userDuser';
                $.popWindow("../common/selectUser");
            })

        });
        //数据列表返回点击事件
        $('.backBtn').click(function(){
            $('.contentTrs').remove();
            $('.mainContent').show();
            $('.details').hide();
            $('.queryDetail').hide();
            $('#noFile').hide();
        })
//    var conId;
        var copyIds='';
        var copyfileId = "";
        var state="";
        var copyCon = 0;
        //复制点击事件
        $('#copy').click(function(){
            copyIds=""
            if($('#copy').hasClass('copyfile')){
                copyfileId = $('.tree-node-selected').attr('node-id');
                state = 'one'
            }else{
                copyCon = 1;
                $('#copyAndShear').attr('sortId','1');
                var zhantieVal=$('input[name="zhantieQuanxian"]').val();
                $(".checkChild:checkbox:checked").each(function(){
                    copyIds+=$(this).attr("conid")+',';
                })
                if(copyIds == ''){
                    $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:2});
                }else{
                    $.layerMsg({content:'<fmt:message code="doc.th.SelectedFile"/>！',icon:1});
                }
            }

        })
        //剪切点击事件
        var fileIds='';
        var orgSortId='';
        $('#shear').click(function(){
            orgSortId=$('.spanFolder').attr('data-id');
            if($('#shear').hasClass('copyfile')){
                copyfileId = $('.tree-node-selected').attr('node-id');
                state = 'two'
            }else{
                copyCon = 1;
                $('#copyAndShear').attr('sortId','2');
                $(".checkChild:checkbox:checked").each(function(){
                    fileIds+=$(this).attr("conId")+',';
                })
                if(fileIds == ''){
                    $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:2});
                }else{
                    $.layerMsg({content:'<fmt:message code="doc.th.SelectedFile"/>！',icon:1});
                    $('#paste').show();
                }
            }

        })
        //粘贴点击事件
        $('#paste').click(function(){
            if(copyCon == 0&&$('#paste').hasClass('copyfile')){
                var arr=copyfileId+','+$('.tree-node-selected').attr('node-id')

                $.ajax({
                    url:'/newFilePri/copyFolder',
                    dataType:'json',
                    type:'get',
                    data:{
                        sortId:arr,
                        state:state
                    },
                    success:function(res){
                        if(res.flag){
                            $.layerMsg({content:'粘贴成功',icon:1});
                            reloadTree();
                        }else{
                            $.layerMsg({content:'粘贴失败',icon:1})
                        }
                    }
                })
            }else{
                var tId=$('#copyAndShear').attr('sortId');
                var sortId=$('.tree-node-selected').attr('node-id');
                var idea=$('input[name="folderId"]').attr('ireader');
                if(tId == '1'){
                    if(copyIds == ''){
                        $.layerMsg({content:'请选择文件！',icon:2});
                    }else{
                        data={
                            witchSortId:sortId,
                            copyId:copyIds,
                            sortType:'5'
                        }
                        copyData('/newFileContent/copyAndParse',data,sortId,idea);
                    }

                }else if(tId == '2'){
                    if(fileIds == ''){
                        $.layerMsg({content:'请选择文件！',icon:2});
                    }else{
                        data={
                            sortId:sortId,
                            contentId:fileIds,
                            sortType:'5',
                            orgSortId:orgSortId
                        }
                        copyData('/newFileContent/fileCut',data,sortId,idea);
                    }
                }else{
                    $.layerMsg({content:'请选择文件！',icon:2});
                }
            }

        })
        //签阅点击事件
        $('#singReading').click(function(){
            if($('#singReading').hasClass('addBackground')){
                return false
            }
            var sortId=$('.tree-node-selected').attr('node-id');
            var idea=$('input[name="folderId"]').attr('ireader');

            var fileId='';
            $(".checkChild:checkbox:checked").each(function(){
                fileId+=$(this).attr("conid")+',';
            })

            if(fileId.length == 0){
                $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:2});
            }else {
                $.ajax({
                    type:'post',
                    url:'/newFileContent/readFile',
                    dataType:'json',
                    data:{'contentId':fileId},
                    success:function(res){
                        if(res.flag){
                            init(sortId,idea);
                        }else{
                            $.layerMsg({content:'签阅失败！',icon:2});
                        }
                    }
                })
            }
        })
        //下载点击事件
        $('.FiveOne').click(function(){
            var text=$('input[name="sortTxt"]').val();
            var fileId=[];
            $(".checkChild:checkbox:checked").each(function(){
                var conId=$(this).attr("conId");
                fileId.push(conId);
            })
            if(fileId == ''){
                $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:1});
                return false;
            }else{
                window.location.href='../file/downFileContent?contentId='+fileId+'&sortName='+text;
            }
        })
        //
        $('#TitleOne').click(function(e){
            e.stopPropagation();
            var pid=$('input[name="paid"]').val();
            $('#classA').toggle();
            if(pid == 0){
                $('.second').hide();
            }else{
                $('.second').show();
            }
        })
        $(document).on('click',function(){
            if($('#classA').css('display')=='block'){
                $('#classA').css('display','none');
            }
        })
        //新建子文件夹页面显示
        $('#newChild').click(function(){
            $('.newAddFolder').show().siblings().hide();
            $('input[name="polderName"]').focus();
        })
        //新建子文件夹页面确定按钮
        $('#btnSure').click(function(){
            var sortParent=$('input[name="folderId"]').val();
            var idea=$('input[name="folderId"]').attr('ireader');
            var editData=$('input[name="folderId"]').attr('editdata');
            if($('input[name="polderName"]').val() != ''){
                var data={
                    'sortType':5,
                    'sortParent':sortParent,
                    'sortNo':$('input[name="serial"]').val(),
                    'sortName':$('input[name="polderName"]').val()
                }
                if($('input[name="serial"]').val() == '' || $('input[name="polderName"]').val() == ''){
                    $.layerMsg({content:'<fmt:message code="doc.th.sortNumber"/>！',icon:2});
                    return false;
                }
                if (isNaN($('input[name="serial"]').val())) {
                    $.layerMsg({content:'<fmt:message code="doc.th.number"/>！',icon:2});
                    $('input[name="serial"]').focus();
                    return false;
                }
                $.ajax({
                    type:'post',
                    url:'/newFilePub/addPubSort',
                    dataType:'json',
                    data:data,
                    success:function(res){
                        if(res.flag){
                            $.layerMsg({content:'<fmt:message code="depatement.th.Newsuccessfully"/>！',icon:1},function(){
//                        $('input[name="serial"]').val('');
                                $('input[name="polderName"]').val('');
                                $('.mainContent').show();
                                $('.newAddFolder').hide();
                                init(sortParent,idea,editData);
                                reloadTree();
                            });
                        }else {
                            $.layerMsg({content:'<fmt:message code="depatement.th.Newfailed"/>！',icon:2});
                        }
                    }
                })
            }else{
                alert('文件夹名称不得为空！')
            }
        })

        /*------------------------------------------------------------------*/
        //查询列表删除
        function dataDeleteOne(fileId,sortId,id){
            layer.confirm('<fmt:message code="sup.th.Delete"/>？', {
                btn: ['<fmt:message code="global.lang.ok"/>','<fmt:message code="depatement.th.quxiao"/>'], //按钮
                title:"<fmt:message code="notice.th.DeleteFile"/>"
            }, function(){
                //确定删除，调接口
                $.ajax({
                    type:'post',
                    url:'/newFileContent/batchDeleteConId',
                    dataType:'json',
                    data:{'fileId':fileId},
                    success:function(){
                        layer.msg('<fmt:message code="workflow.th.delsucess"/>', { icon:6});
                        queryOneData(sortId,id);
                    }
                })

            }, function(){
                layer.closeAll();
            });
        }
        //查询列表方法
        function queryOneData(sortId,id,iReder){
            var ajaxPage={
                data:{
                    'sortId':sortId,
                    'pageNo':0,
                    'pageSize':10,
                    'subjectName':$('input[name="subjectName"]').val(),
                    'contentNo':$('input[name="contentNo"]').val(),
                    'creater':id,
                    'contentValue1':$('input[name="contentValue1"]').val(),
                    'contentValue2':$('input[name="contentValue2"]').val(),
                    'contentValue3':$('input[name="contentValue3"]').val(),
                    'atiachmentDesc':$('input[name="atiachmentDesc"]').val(),
                    'atiachmentName':$('input[name="atiachmentName"]').val(),
                    'atiachmentCont':$('input[name="atiachmentCont"]').val(),
                    'crStartDate':$('input[name="crStartDate"]').val(),
                    'crEndDate':$('input[name="crEndDate"]').val(),
                    'sortType':'5'
                },
                page:function () {
                    var me=this;
                    $.ajax({
                        type:'post',
                        url:'/newFileContent/queryFile',
                        dataType:'json',
                        data:me.data,
                        success:function(res){
                            $('#file_Tachrs').find('tr').remove();
                            var data1=res.datas;
                            var str = '';
                            var files = '';
                            var downUser=$('input[name="down-user"]').val();
                            for(var i=0;i<data1.length;i++){
                                var arr=data1[i].attachmentList;
                                if(data1[i].attachmentList!='' && data1[i].attachmentList!= undefined){
                                    str+="  <tr class='contentTrs' sortId='"+data1[i].sortId+"' contentId='"+data1[i].contentId+"' conType='2'><td><input class='checkChildren' type='checkbox' conId='"+data1[i].contentId+"' name='check' value='' > <a class='TITLE' style='color:#54b6fe;display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;' href='javascript:;'>"+data1[i].subject+ "  </a></td>  <td>"+attachView(arr,'','3',$('input[name="editQuanxian"]').val(),$('input[name="exportQuanxian"]').val(),'0')+"</td> <td> "+data1[i].sendTime+ "  </td><td> "+data1[i].contentNo+ "  </td><td><a href='javascript:;' class='editBtn'><fmt:message code="global.lang.edit"/></a>";
                                    if(iReder == '1'){
                                        str+="<a href='javascript:;' class='signReading'><fmt:message code="meet.th.ReadingStatus"/></a>"
                                    }
                                    str+="</td></tr>"
                                }else{
                                    str+="  <tr class='contentTrs' sortId='"+data1[i].sortId+"' contentId='"+data1[i].contentId+"' conType='2'><td><input class='checkChildren' type='checkbox' conId='"+data1[i].contentId+"' name='check' value='' > <a class='TITLE'  style='color:#54b6fe;display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;' href='javascript:;'>"+data1[i].subject+ "  </a></td>  <td></td> <td> "+data1[i].sendTime+ "  </td><td> "+data1[i].contentNo+ "  </td><td><a href='javascript:;' class='editBtn'><fmt:message code="global.lang.edit"/></a>";
                                    if(iReder == '1'){
                                        str+="<a href='javascript:;' class='signReading'><fmt:message code="meet.th.ReadingStatus"/></a>"
                                    }
                                    str+="</td></tr>"
                                }
                            }
                            $('#file_Tachrs').html(str);
                            me.pageTwo(res.total,me.data.pageSize,me.data.page)
                            $(".contentTrs").click(function () {
                                var state=$(this).find('.checkChildren').prop("checked");
                                if(state==true){
                                    $(this).find('.checkChildren').prop("checked",true);
                                    $(this).addClass('bgcolor');
                                    $('#queryDelete').removeClass('addBackground');
                                }else{
                                    $('#checkedAlls').prop("checked",false);
                                    $(this).find('.checkChildren').prop("checked",false);
                                    $(this).removeClass('bgcolor');
                                    $('#queryDelete').addClass('addBackground');
                                }
                                var child =   $(".checkChildren");
                                for(var i=0;i<child.length;i++){
                                    var childstate= $(child[i]).prop("checked");
                                    if(state!=childstate){
                                        return
                                    }
                                }
                                $('#checkedAlls').prop("checked",state);
                            })
                            $('#queryDelete').addClass('addBackground');

                            $('#checkedAlls').prop("checked",false);
                        }
                    })

                },
                pageTwo:function (totalData, pageSize,indexs) {
                    var mes=this;
                    $('#dbgz_pages').pagination({
                        totalData: totalData,
                        showData: pageSize,
                        jump: true,
                        coping: true,
                        homePage:'',
                        endPage: '',
                        current:indexs||1,
                        callback: function (index) {
                            mes.data.page=index.getCurrent();
                            mes.page();
                        }
                    });
                }
            }
            ajaxPage.page();
        }
        /*-----------------------------------------------------------------------------------*/
        //全局搜索删除列表
        function dataDeleteAll(fileId,id){
            layer.confirm('<fmt:message code="sup.th.Delete"/>？', {
                btn: ['<fmt:message code="global.lang.ok"/>','<fmt:message code="depatement.th.quxiao"/>'], //按钮
                title:"<fmt:message code="notice.th.DeleteFile"/>"
            }, function(){
                //确定删除，调接口
                $.ajax({
                    type:'post',
                    url:'/newFileContent/batchDeleteConId',
                    dataType:'json',
                    data:{'fileId':fileId},
                    success:function(){
                        layer.msg('<fmt:message code="workflow.th.delsucess"/>', { icon:6});
                        sortId='';
                        queryAllData(id);
                    }
                })

            }, function(){
                layer.closeAll();
            });

        }
        //全局搜索列表方法
        function queryAllData(id){
            var ajaxPage={
                data:{
                    contentId:contentId,
                    sortType:'5',
                    page:1,
                    pageSize:10,
                    useFlag:true,
                    'serachType':'2',
                    'subject':$('input[name="subject"]').val(),
                    'sort_no':$('input[name="sort_no"]').val(),
                    'creater':id,
                    'keyword1':$('input[name="keyword1"]').val(),
                    'keyword2':$('input[name="keyword2"]').val(),
                    'keyword3':$('input[name="keyword3"]').val(),
                    'attScript':$('input[name="attScript"]').val(),
                    'attName':$('input[name="attName"]').val(),
                    'attContain':$('input[name="attContain"]').val(),
                    'begainTime':$('input[name="begainTime"]').val(),
                    'endTime':$('input[name="endTime"]').val(),
                },
                page:function () {
                    var me=this;
                    $.ajax({
                        type:'post',
                        url:'/newFileContent/serachAll',
                        dataType:'json',
                        data:me.data,
                        success:function(res){
                            $('#file_Tach').find('tr').remove();
                            var data1=res.obj;
                            var str='';
                            var arr=new Array();
                            for(var i=0;i<data1.length;i++){
                                var stra='';
                                arr=data1[i].attachmentList;
                                if(data1[i].attachmentName!=''){
                                    for(var j=0;j<arr.length;j++){

                                        var iconType='';
                                        if(GetFileExt(arr[j].attachName) == '.docx' || GetFileExt(arr[j].attachName) == '.doc' || GetFileExt(arr[j].attachName) == '.DOC' || GetFileExt(arr[j].attachName) == '.DOCX' || GetFileExt(arr[j].attachName) == '.word' || GetFileExt(arr[j].attachName) == '.WORD'){
                                            iconType='word';
                                        }else if(GetFileExt(arr[j].attachName) == '.pptx' || GetFileExt(arr[j].attachName) == '.ppt'){
                                            iconType='ppt';
                                        }else if(GetFileExt(arr[j].attachName) == '.xlsx' || GetFileExt(arr[j].attachName) == '.xls'){
                                            iconType='excel';
                                        }else if(GetFileExt(arr[j].attachName) == '.pdf'){
                                            iconType='pdf';
//                                            iconType=GetFileExt(arr[j].attachName).replace('.', "")
                                        }else if(GetFileExt(arr[j].attachName) == '.exe'){
                                            iconType='exe';
                                        }else if(GetFileExt(arr[j].attachName) == '.jpg' || GetFileExt(arr[j].attachName) == '.png'){
                                            iconType='pic';
                                        }else if(GetFileExt(arr[j].attachName) == '.rar' || GetFileExt(arr[j].attachName) == '.zip'){
                                            iconType='zip';
                                        }else {
                                            iconType='file';
                                        }

                                        var attUrl_s = arr[j].attUrl;

                                        var attName = encodeURI(arr[j].attachName).replace(/\+/g, "%2b").replace(/\@/g,"%40").replace(/\#/g,"%23").replace(/\&/g,"%26");

                                        attUrl_s = attUrl_s.substring(0,attUrl_s.lastIndexOf("ATTACHMENT_NAME="))+"ATTACHMENT_NAME="+attName;
                                        if($('input[name="exportQuanxian"]').val() == '0'){
                                            stra+='<a href="javascript:void(0);" style="display:block;"><img style="width:18px;height:22px;margin-right:5px;" src="../img/attachmentIcon/'+iconType+'.png"/>'+arr[j].attachName+'</a>';

                                        }else{
                                            stra+='<a href="<%=basePath %>download?'+encodeURI(attUrl_s)+'" style="display:block;"><img style="width:18px;height:22px;margin-right:5px;" src="../img/attachmentIcon/'+iconType+'.png"/>'+arr[j].attachName+'</a>';

                                        }
                                    }
                                    str+='<tr class="contentT" sortId="'+data1[i].sortId+'" contentId="'+data1[i].contentId+'" conType="3"><td><input class="checkChildren" conId="'+data1[i].contentId+'" type="checkbox" name="check" value="" style="margin-right:15px;" >'+data1[i].filePath+'</td><td><a class="TITLE" href="javascript:;"  style="color:#54b6fe;display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">'+data1[i].subject+'</a></td><td>'+stra+'</td><td>'+function () {
                                        if(data1[i].attachmentDesc != undefined){
                                            return data1[i].attachmentDesc;
                                        }else {
                                            return '';
                                        }
                                    }()+'</td><td>'+data1[i].sendTime+'</td><td>';
                                    if(data1[i].mapPriv.MANAGE_USER == 1){
                                        str+='<a href="javascript:;" class="editBtn"><fmt:message code="global.lang.edit"/></a>';
                                    }
                                    if(data1[i].mapPriv.SIGN_USER == 1){
                                        str+='<a href="javascript:;" class="signReading"><fmt:message code="meet.th.ReadingStatus"/></a>';
                                    }
                                    str+='</td></tr>';
                                }else {
                                    str+='<tr class="contentT" sortId="'+data1[i].sortId+'" contentId="'+data1[i].contentId+'" conType="3"><td><input class="checkChildren" conId="'+data1[i].contentId+'" type="checkbox" name="check" value="" style="margin-right:15px;" >'+data1[i].filePath+'</td><td><a class="TITLE" href="javascript:;"   style="color:#54b6fe;display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">'+data1[i].subject+'</a></td><td></td><td>'+function () {
                                        if(data1[i].attachmentDesc != undefined){
                                            return data1[i].attachmentDesc;
                                        } else{
                                            return '';
                                        }
                                    }()+'</td><td>'+data1[i].sendTime+'</td><td>';
                                    if(data1[i].mapPriv.MANAGE_USER == 1){
                                        str+='<a href="javascript:;" class="editBtn"><fmt:message code="global.lang.edit"/></a>';
                                    }
                                    if(data1[i].mapPriv.SIGN_USER == 1){
                                        str+='<a href="javascript:;" class="signReading"><fmt:message code="meet.th.ReadingStatus"/></a>';
                                    }
                                    str+='</td></tr>';
                                }
                            }
                            $('#file_Tach').html(str);
                            me.pageTwo(res.totleNum,me.data.pageSize,me.data.page)
                            $(".contentT").click(function () {
                                var state=$(this).find('.checkChildren').prop("checked");
                                if(state==true){
                                    $(this).find('.checkChildren').prop("checked",true);
                                    $(this).addClass('bgcolor');
                                }else{
                                    $('#checkedAllY').prop("checked",false);
                                    $(this).find('.checkChildren').prop("checked",false);
                                    $(this).removeClass('bgcolor');
                                }
                                if($('#file_Tach .checkChildren:checked').length != 0){
                                    $('#deleteAll').removeClass('addBackground');
                                }else{
                                    $('#deleteAll').addClass('addBackground');
                                }
                                var child =   $(".checkChildren");
                                for(var i=0;i<child.length;i++){
                                    var childstate= $(child[i]).prop("checked");
                                    if(state!=childstate){
                                        return
                                    }
                                }
                                $('#checkedAllY').prop("checked",state);
                            })
                            $('#deleteAll').addClass('addBackground');

                            $('#checkedAllY').prop("checked",false);
                        }
                    })
                },
                pageTwo:function (totalData, pageSize,indexs) {
                    var mes=this;
                    $('#dbgz_pagesd').pagination({
                        totalData: totalData,
                        showData: pageSize,
                        jump: true,
                        coping: true,
                        homePage:'',
                        endPage: '',
                        current:indexs||1,
                        callback: function (index) {
                            mes.data.page=index.getCurrent();
                            mes.page();
                        }
                    });
                }
            }
            ajaxPage.page();
        }
        /*-------------------------------------------------------------------------------*/

        //新建子文件夹页面返回按钮
        $('#btnBack').click(function(){
//        $('input[name="serial"]').val('');
            $('input[name="polderName"]').val('');
            $('.mainContent').show();
            $('.newAddFolder').hide();
        })
        //编辑页面显示
        $('#editFile').click(function(){
            $('.editAddFolder').show().siblings().hide();
            var sortId=$('input[name="folderId"]').val();
            $.ajax({
                type:'get',
                url:'../file/fileGetOne',
                dataType:'json',
                data:{'sortId':sortId},
                success:function(res){
                    var data=res.object;
                    $('input[name="edSerial"]').val('');
                    $('input[name="edPolderName"]').val('');

                    $('input[name="edSerial"]').val(data.sortNo);
                    $('input[name="edPolderName"]').val(data.sortName);
                }
            })
        })
        //编辑页面确定按钮
        $('#editSure').click(function(){
            var sortId=$('input[name="folderId"]').val();
            var idea=$('input[name="folderId"]').attr('ireader');
            var editData=$('input[name="folderId"]').attr('editdata');
            if($('input[name="edPolderName"]').val() == ''){
                alert('文件夹名称不得为空！');
            }else{
                var data={
                    'sortId':sortId,
                    'sortNo':$('input[name="edSerial"]').val(),
                    'sortName':$('input[name="edPolderName"]').val()
                }
                $.ajax({
                    type:'post',
                    url:'/newFilePub/updPubSort',
                    dataType:'json',
                    data:data,
                    success:function(res){
                        if(res.flag){
                            $.layerMsg({content:'<fmt:message code="depatement.th.Modifysuccessfully"/>！',icon:1},function(){
                                $('.editAddFolder').hide();
                                $('.mainContent').show();
                                init(sortId,idea,editData);
                                reloadTree();
                            });
                        }else{
                            $.layerMsg({content:'<fmt:message code="depatement.th.modifyfailed"/>！',icon:2},function(){
                                console.log('<fmt:message code="depatement.th.modifyfailed"/>')
                            });
                        }
                    }
                })
            }
        })
        //设置权限按钮
        $('#setting').click(function(){
            var sortId=$('.tree-node-selected').attr('node-id');
            $.popWindow('/newFilePub/tempHome?sortId='+sortId+'','<fmt:message code="netdisk.th.PermissionSetting"/>','0','0','1500px','800px');
        })
        //编辑页面返回按钮
        $('#editBack').click(function(){
            $('input[name="edSerial"]').val('');
            $('input[name="edPolderName"]').val('');
            $('.editAddFolder').hide();
            $('.mainContent').show();
        })
        //删除子文件夹按钮
        $('#deleteFile').click(function(){
            var sortId=$('input[name="folderId"]').val();
            var idea=$('input[name="folderId"]').attr('ireader');
            var editData=$('input[name="folderId"]').attr('editdata');
            layer.confirm('<fmt:message code="sys.th.commit"/>！', {
                btn: ['<fmt:message code="global.lang.ok"/>','<fmt:message code="depatement.th.quxiao"/>'], //按钮
                title:"<fmt:message code="notice.th.DeleteFile"/>"
            }, function(){
                //确定删除，调接口
                $.ajax({
                    type:'post',
                    url:'/newFilePub/delPubSort',
                    dataType:'json',
                    data:{'sortId':sortId},
                    success:function(res){
                        if(res.flag == true){
                            layer.msg('<fmt:message code="workflow.th.delsucess"/>', { icon:6});
                            init(1,idea,editData);
                            reloadTree();
                        }else{
                            layer.msg('<fmt:message code="lang.th.deleSucess"/>', { icon:5});
                        }
                    }
                });

            }, function(){
                layer.closeAll();
            });
        })
        var user_id='dePsenduser';
        $(function(){
            //选人控件
            $("#selectUserDep").on("click",function(){
                user_id='dePsenduser';
                $.popWindow("../common/selectUser");
            });
            //清空所选人员
            $('.clear').click(function(){
                $('#dePsenduser').val('');
                $('#dePsenduser').attr('user_id','');
            })

            $('#uploadinputimg').change(function(){
                var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
                var isOpera = userAgent.indexOf("Opera") > -1;
                $(".attach").show();
                if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera){
                    //alert(111);
                    var src = $(this).target || window.event.srcElement; //获取事件源，兼容chrome/IE
                    var filename = src.value;
                    var str = filename.substring(filename.lastIndexOf('\\') + 1);
                    $('.box').html(str);
                }else{
                    var arr=$(this)[0].files;
                    var length = arr.length;
                    var str='';
                    //alert(arr);
                    //alert(length);
                    for(var i=0;i<arr.length;i++){
                        str+='<p>'+arr[i].name+'</p>';
                    }
                    $('.box').html(str);
                }

            })


            $('#start').click(function(){
                var index = layer.load(3, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
                var sortId=$('[name="sortId"]').val();
                var idea=$('input[name="folderId"]').attr('ireader');
                var editData=$('input[name="folderId"]').attr('editdata');
                var remindVal=0;
                if($('.remindCheck').is(":checked")){
                    remindVal=1;
                }
                var smsDefault =1;
                if($('.smsDefault').is(":checked")){
                    smsDefault=0;
                }
                $('#uploadimgform').ajaxSubmit({
                    dataType:'json',
                    data:{
                        sortType:'5',
                        remind:remindVal,//事务提醒
                        smsDefault:smsDefault //手机提醒
                    },
                    success:function (res) {
                        if(res.status == true){
                            $('.box').children().remove();
                            $('.attach').hide();
                            init(sortId,idea,editData);
                            layer.close(index);
                        }else {
                            if(res.msg == 'notEnough'){
                                layer.msg('文件夹容量不足！', {icon: 2});
                                $('.box').children().remove();
                                $('.attach').hide();
                                layer.close(index);
                            }else{
                                layer.msg('上传失败！'+res.msg+'个空文件未上传', {icon: 2});
                                $('.box').children().remove();
                                $('.attach').hide();
                                layer.close(index);
                            }
                        }
                    }
                })
            })

//       文件编辑
            $("#file_Tachr").on('click','.editBoxBtn',function(){
                var idT=$(this).parents('tr').attr('contentId');
                var sortId=$(this).parents('tr').attr('sortId');
                <%--$.popWindow('<%=basePath%>file/contentAdd?contentId='+idT+'&sortId='+sortId,'编辑','100','300','860px','500px');--%>
                var contype=$(this).parents('tr').attr('conType');
                var idea=$('input[name="folderId"]').attr('ireader');
                $.popWindow('/newFilePub/newFiles?contentId='+idT+'&sortId='+sortId+'&contype='+contype+'&idea='+idea+'&ie_open=yes','<fmt:message code="global.lang.edit"/>','0','0','1500px','800px');
            })

            //全部取消点击事件
            $('.cancle').click(function(){
                $('.box').children().remove();
                $('.attach').hide();
            })

        })
        function buildNode(data){
            $.each(data,function(i,item){

                if(item.children!= undefined && 0 < item.children.length){
                    var node = $("#fileTree").tree("find",data[i].id);//找到id对应的节点
                    $(node.target).attr("title",data[i].text);//.target得到dom对象，设置title
                    buildNode(item.children);
                }else{
                    var node = $("#fileTree").tree("find",data[i].id);//找到id对应的节点
                    $(node.target).attr("title",data[i].text);//.target得到dom对象，设置title
                }
            });
        }



    });
    function TreeNode(id,text,state,children){
        this.id = id;
        this.text = text;
        this.state = state;
        this.children = children;
    }


    function copyData(url,data,sortId,iReader,editdatas){
//        var sortId=$('.tree-node-selected').attr('node-id');
        $.ajax({
            type:'post',
            url:url,
            dataType:'json',
            data:data,
            success:function(res){
                if(res.flag==true){
                    $.layerMsg({content:'<fmt:message code="file.th.PasteSuccessfully"/>！',icon:1},function(){
                        init(sortId,iReader,editdatas);
                    });
                }else{
                    if(res.msg == 'notEnough'){
                        layer.msg('文件夹容量不足！', {icon: 2});
                    }else{
                        layer.msg('粘贴失败！', {icon: 2});
                    }
                }
            }
        })
    }

    function dataDelete(fileId,id,iReader,editdatas){
        layer.confirm('<fmt:message code="sup.th.Delete"/>？', {
            btn: ['<fmt:message code="global.lang.ok"/>','<fmt:message code="depatement.th.quxiao"/>'], //按钮
            title:"<fmt:message code="notice.th.DeleteFile"/>"
        }, function(){
            //确定删除，调接口
            $.ajax({
                type:'post',
                url:'/newFileContent/batchDeleteConId',
                dataType:'json',
                data:{
                    'fileId':fileId,
                    sortType:'5'
                },
                success:function(){
                    layer.msg('<fmt:message code="workflow.th.delsucess"/>', { icon:6});
                    init(id,iReader,editdatas);
                }
            })

        }, function(){
            layer.closeAll();
        });

    }


    function convert(data){
        var arr = [];
        data.forEach(function(v,i){
            if(v.sortName){
                var node = new TreeNode(v.sortId,v.sortName,"closed")
                arr.push(node);
            }
        });
        return arr;
    }
    //当窗口变大或变小时，重置高度
    $(window).resize(function() {
        var Height=$('body').height()-2;
        $('.cabinet_left').height(Height);
    });

    function init(id,iReder,editData) {
        var ajaxPage={
            data:{
                sortId:id,
                page:1,//当前处于第几页
                pageSize:10,//一页显示几条
                useFlag:true,
                sortType:5
            },
            page:function () {
                $('.contentTr').remove();
                var me=this;
                $.ajax({
                    type:'post',
                    url:'/newFileContent/getContentById',
                    dataType:'json',
                    data:me.data,
                    success:function(res){
                        var data=res.object.contentList;
                        var nodeData=res.object;
                        var files='';
                        var arr=new Array();


                        $('input[name="down-user"]').val(nodeData.attributes.DOWN_USER);
                        if(nodeData.attributes.DEL_USER == 1){ //删除权限
                            $('#deletebtn').show();
                            $('#deleteFile').show();
                            $('#shear').show();
                            $('input[name="deleteQuanxian"]').val('1');
                        }else{
                            $('#deletebtn').hide();
                            $('#deleteFile').hide();
                            $('#shear').hide();
                            $('input[name="deleteQuanxian"]').val('0');
                        }
                        if(nodeData.attributes.DOWN_USER == 1){ //下载权限
                            $('#download').show();
                            $('input[name="exportQuanxian"]').val('1');
                        }else{
                            $('#download').hide();
                            $('input[name="exportQuanxian"]').val('0');
                        }
                        if(nodeData.attributes.OWNER == 1){ //拥有者权限
                            $('#setting').show();
                            $('input[name="ownerQuanxian"]').val('1');
                            $('#newsAdd').show();
                            $('#newChild').show();
                            $('#batch').show();
                            $('#paste').show();
                        }else{
                            $('#setting').hide();
                            $('input[name="ownerQuanxian"]').val('0');
                            if(nodeData.attributes.NEW_USER == 1){ //新建权限
                                $('#newsAdd').show();
                                $('#newChild').show();
                                $('#batch').show();
                                $('#paste').show();
                            }else{
                                $('#newsAdd').hide();
                                $('#newChild').hide();
                                $('#batch').hide();
                                $('#paste').hide();
                            }
                        }
                        if(nodeData.attributes.REVIEW == 1){ //评论权限
                            $('input[name="reviewQuanxian"]').val('1');
                        }else{
                            $('input[name="reviewQuanxian"]').val('0');
                        }

                        if(nodeData.attributes.MANAGE_USER == 1){ //编辑权限
                            $('#editFile').show();
                            $('input[name="editQuanxian"]').val('1');
                        }else{
                            $('#editFile').hide();
                            $('input[name="editQuanxian"]').val('0');
                        }

                        if(nodeData.attributes.SIGN_USER == 1){  //签阅权限
                            $('#singReading').show();
                            $('input[name="qianyueQuanxian"]').val('1');
                        }else{
                            $('#singReading').hide();
                            $('input[name="qianyueQuanxian"]').val('0');
                        }

                        $('input[name="sortTxt"]').val(nodeData.text);
                        $('input[name="paid"]').val(nodeData.attributes.pid);
                        $('input[name="folderId"]').val(nodeData.sortId);
                        ireaeders=$('input[name="folderId"]').attr('iReader',nodeData.attributes.SIGN_USER);
                        editdatas=$('input[name="folderId"]').attr('editdata',nodeData.attributes.MANAGE_USER);
                        var downUser=nodeData.attributes.DOWN_USER;
                        if(data.length > 0 ){
                            for(var i=0;i<data.length;i++){

                                var str1='';
                                var editBox='';
                                if($('input[name="editQuanxian"]').val() == '1'){
                                    editBox='<a href="javascript:;" class="editBoxBtn" style="margin-left: 10px;"><fmt:message code="global.lang.edit"/></a>';
                                }else{
                                    editBox='';
                                }
                                if(data[i].attachmentName!=''){
                                    arr=data[i].attachmentList;
                                    if(data[i].isRead == 0){
                                        files+="  <tr class='contentTr' sortId='"+data[i].sortId+"' TYPE='"+data[i].fileType+"' contentId='"+data[i].contentId+"' data-isread='"+data[i].isRead+"' conType='1'><td><input class=\"checkChild\" style='margin-top: -2px;vertical-align: top' type=\"checkbox\" conId='"+data[i].contentId+"' name=\"check\" value=\"\" ><a class='TITLE' href='javascript:;'   style='color:#54b6fe;display: inline-block;'> <img src='../img/file/icon_notread_1_03.png' style='width: 16px;height: 16px;margin-left: 4px;margin-top:3px;vertical-align: top;'>"+data[i].subject+ "  </a></td>  <td>"+attachView(arr,'','3',nodeData.attributes.MANAGE_USER,nodeData.attributes.DOWN_USER,'0')+"</td> <td> "+data[i].sendTime+ "  </td><td> "+data[i].contentNo+ "  </td><td>";
                                        if(nodeData.attributes.SIGN_USER == 1){
                                            files+="<a href='javascript:;' class='signReading'><fmt:message code="meet.th.ReadingStatus"/></a>"
                                        }
                                        files+=editBox+"</td></tr>"
                                    }else{
                                        files+="  <tr class='contentTr' sortId='"+data[i].sortId+"' TYPE='"+data[i].fileType+"' contentId='"+data[i].contentId+"' data-isread='"+data[i].isRead+"' conType='1'><td><input class=\"checkChild\" style='margin-top: -2px;vertical-align: top' type=\"checkbox\" conId='"+data[i].contentId+"' name=\"check\" value=\"\" > <a class='TITLE' href='javascript:;'   style='color:#54b6fe;display: inline-block;'>"+data[i].subject+ "  </a></td>  <td>"+attachView(arr,'','3',nodeData.attributes.MANAGE_USER,nodeData.attributes.DOWN_USER,'0')+"</td> <td> "+data[i].sendTime+ "  </td><td> "+data[i].contentNo+ "  </td><td>";
                                        if(nodeData.attributes.SIGN_USER == 1){
                                            files+="<a href='javascript:;' class='signReading'><fmt:message code="meet.th.ReadingStatus"/></a>"
                                        }
                                        files+=editBox+"</td></tr>"
                                    }
                                }else{
                                    if(data[i].isRead == 0){
                                        files+="  <tr class='contentTr' sortId='"+data[i].sortId+"' TYPE='"+data[i].fileType+"' contentId='"+data[i].contentId+"' data-isread='"+data[i].isRead+"' conType='1'><td><input class=\"checkChild\" style='margin-top: -2px;vertical-align: top' type=\"checkbox\" conId='"+data[i].contentId+"' name=\"check\" value=\"\" > <a class='TITLE' href='javascript:;'  style='color:#54b6fe;display: inline-block;'><img src='../img/file/icon_notread_1_03.png' style='width: 16px;height: 16px;margin-left: 4px;margin-top: 3px;vertical-align: top;'>"+data[i].subject+ "  </a></td>  <td><a href='javascript:;'></a></td> <td> "+data[i].sendTime+ "  </td><td> "+data[i].contentNo+ "  </td><td>";

                                        if(nodeData.attributes.SIGN_USER == 1){
                                            files+="<a href='javascript:;' class='signReading'><fmt:message code="meet.th.ReadingStatus"/></a>"
                                        }
                                        files+=editBox+"</td></tr>"
                                    }else{
                                        files+="  <tr class='contentTr' sortId='"+data[i].sortId+"' TYPE='"+data[i].fileType+"' contentId='"+data[i].contentId+"' data-isread='"+data[i].isRead+"' conType='1'><td><input class=\"checkChild\" style='margin-top: -2px;vertical-align: top' type=\"checkbox\" conId='"+data[i].contentId+"' name=\"check\" value=\"\" > <a class='TITLE' href='javascript:;'  style='color:#54b6fe;display: inline-block;'>"+data[i].subject+ "  </a></td>  <td><a href='javascript:;'></a></td> <td> "+data[i].sendTime+ "  </td><td> "+data[i].contentNo+ "  </td><td>";
                                        if(nodeData.attributes.SIGN_USER == 1){
                                            files+="<a href='javascript:;' class='signReading'><fmt:message code="meet.th.ReadingStatus"/></a>"
                                        }
                                        files+=editBox+"</td></tr>"
                                    }
                                }
                            }
                        }else{
                            files='<tr><td colspan="5"><div style="margin: 20px 0;width: 100%;text-align: center;"><fmt:message code="file.th.noFiles"/></div></td></tr>';
                        }
                        $("#file_Tachr").html(files);
                        me.pageTwo(res.total,me.data.pageSize,me.data.page)
                        $('[name="sortId"]').val(id)
                        $(".contentTr").click(function () {
                            var state=$(this).find('.checkChild').prop("checked");
                            var len = $('#file_Tachr').find('.checkChild:checked').length;
                            if(state==true){
                                $(this).find('.checkChild').prop("checked",true);
                                $(this).addClass('bgcolor');

                            }else{
                                $('#checkedAll').prop("checked",false);
                                $(this).find('.checkChild').prop("checked",false);
                                $(this).removeClass('bgcolor');

                            }
                            if(len>0){
                                $('#singReading').removeClass('addBackground');
                                $('#copy').removeClass('addBackground').removeClass('copyfile');
                                $('#shear').removeClass('addBackground').removeClass('copyfile');
                                $('#paste').removeClass('addBackground').removeClass('copyfile');
                                $('#deletebtn').removeClass('addBackground');
                            }else{
                                $('#singReading').addClass('addBackground');
                                $('#copy').addClass('copyfile');
                                $('#shear').addClass('copyfile');
                                $('#paste').addClass('copyfile');
                                $('#deletebtn').addClass('addBackground');
                            }
                            var child =   $(".checkChild");
                            for(var i=0;i<child.length;i++){
                                var childstate= $(child[i]).prop("checked");
                                if(state!=childstate){
                                    return
                                }
                            }
                            $('#checkedAll').prop("checked",state);
                        })
                        $('#singReading').addClass('addBackground');
                        $('#copy').addClass('copyfile').removeClass('addBackground');
                        $('#shear').addClass('copyfile').removeClass('addBackground');
                        $('#paste').addClass('copyfile').removeClass('addBackground');
                        $('#deletebtn').addClass('addBackground');

                        $('#checkedAll').prop("checked",false);
                    }
                });

            },
            pageTwo:function (totalData, pageSize,indexs) {
                var mes=this;
                $('#dbgz_page').pagination({
                    totalData: totalData,
                    showData: pageSize,
                    jump: true,
                    coping: true,
                    homePage:'',
                    endPage: '',
                    current:indexs||1,
                    callback: function (index) {
                        mes.data.page=index.getCurrent();
                        mes.page();
                    }
                });
            }
        }
        ajaxPage.page();
    }

    //处理树结构
    function convert1(rows) {
        function exists(rows, parentId) {
            for (var i = 0; i < rows.length; i++) {
                if (rows[i].sortId == parentId) return true;
            }
            return false;
        }
        var nodes = [];
        if(rows != undefined){
            for (var i = 0; i < rows.length; i++) {
                var row = rows[i];
                if (!exists(rows, row.sortParent)) {
                    nodes.push({
                        id: row.sortId,
                        text: row.sortName,
                        attributes:row.attributes
                    });
                }
            }
        }

        var toDo = [];
        for (var i = 0; i < nodes.length; i++) {
            toDo.push(nodes[i]);
        }
        while (toDo.length) {
            var node = toDo.shift();	// the parent node
            // get the children nodes
            for (var i = 0; i < rows.length; i++) {
                var row = rows[i];
                if (row.sortParent == node.id) {
                    var child = {id: row.sortId, text: row.sortName,attributes:row.attributes};
                    if (node.children) {
                        if (node.id != 0) {
                            node.state = "closed"
                        }
                        node.children.push(child);
                    } else {

                        node.children = [child];
                    }
                    toDo.push(child);
                }
            }
        }
        return nodes;
    }

    function getUrlString(name, url) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        re = new RegExp("amp;", "g"); //定义正则表达式
        var r = url.match(reg);
        var context = "";
        if (r != null)
            context = r[2];
        reg = null;
        r = null;
        return context == null || context == "" || context == "undefined" ? "" : context;
    }

    // 附件全选、单选
    function checkFileInput(e, allType, fileType) {
        var allInput = '';
        var fileInput = '';
        switch (fileType) {
            case 1:
                allInput = '#formFilesInputAll';
                fileInput = '.form_files_input';
                break;
            case 2:
                allInput = '#commonFilesInputAll';
                fileInput = '.common_files_input';
                break;
            case 3:
                allInput = '#mainFilesInputAll';
                fileInput = '.main_files_input';
                break;
        }
        // 全选
        if (allType === 0) {
            var checkedOfAll = $(allInput).prop("checked");
            $(fileInput).prop("checked", checkedOfAll);
        } else if (allType === 1) { // 单选
            var $this = $(this);
            if ($this.checked == false) {
                $(allInput).prop('checked', false);
            } else {
                var count = $(fileInput + ":checkbox:checked").length;
                if (count == $(fileInput).length) {
                    $(allInput).prop("checked", true);
                } else {
                    $(allInput).prop("checked", false);
                }
            }
        }
    }


    var isNomalType =  $.GetRequest().isNomalType;
    var tabId =  $.GetRequest().tabId;
    var tableName =  $.GetRequest().tableName;
    var parent = $.GetRequest().parent||'';
    var formInfo = $.GetRequest().formInfo||'';

    if(formInfo != ''){
        $('.foot').hide();
    };
    //声明oa精灵下打印按钮点击后的情况判断
    var printType ={flag:false,biaodan:false,fujian:false,huiqian:false,liucheng:false}

    $(function(){
        var flowId = $.getQueryString("flowId");
        var flowStep = $.GetRequest().flowStep || '';
        var runId = $.getQueryString("runId") || '';
        $('title').html('查看详情-NO. '+runId)
        var prcsId=$.GetRequest().prcsId || '';
        var tabId = $.getQueryString("tabId") || '';
        var tableName = $.getQueryString("tableName") || '';
        var SignLoadFlag = false;
        var sign_arr = [];
        var printBtn = $.getQueryString("printBtn") || '';
        var printTypeNum= $.getQueryString("printType") || '';

        $('.rig_h1one').click(function(){
            $('.floatRight').toggle();
        });
        // 更多操作 公告通知
        $('#notify_add').click(function () {
            layer.open({
                type: 1,
                skin: 'layui-layer-rim', //加上边框
                area: ['550px', '240px'], //宽高
                title:'公告通知工作流信息',
                content: '<div style="padding: 10px">' +
                    '<h1 style="font-size: 16px">内容选择：</h1>'+
                    '<div class="notify_add_div" style="margin-top: 10px;margin-left: 10px;font-size: 16px">'+
                    '<input type="checkbox" name="check1" id="check1" checked="" value="1" class="noticeinput"> <label for="check1" style="margin-right: 12px;display: inline;font-size: 16px">表单</label>' +
                    '<input type="checkbox" name="check2" id="check2" checked="" value="2" class="noticeinput"> <label for="check2" style="margin-right: 12px;display: inline;font-size: 16px">公共附件</label>' +
                    '<input type="checkbox" name="check3" id="check3" checked="" value="3" class="noticeinput"> <label for="check3" style="margin-right: 12px;display: inline;font-size: 16px">会签与点评</label>' +
                    '<input type="checkbox" name="check4" id="check4" checked="" value="4" class="noticeinput"> <label for="check4" style="margin-right: 12px;display: inline;font-size: 16px">流程图</label></div></div>',
                btn: ['确定', '取消'],
                yes: function(index){
                    var chk_value ='';
                    var runId = $.getQueryString("runId") || '';
                    $('.notify_add_div input[type="checkbox"]:checked').each(function(){
                        chk_value+=$(this).val();
                    });
                    window.open('/notice/newAndEdit?type=new&chkValue='+chk_value+'&runId='+runId);
                    layer.closeAll();
                },
                btn2: function() {
                    layer.closeAll();
                }
            });
        });
        // 办理页面进内部分发
        $('#noticeBottom').click(function () {
            layer.open({
                type: 1,
                skin: 'layui-layer-rim', //加上边框
                area: ['550px', '240px'], //宽高
                title:'公告通知工作流信息',
                content: '<div style="padding: 10px">' +
                    '<h1 style="font-size: 16px">内容选择：</h1>'+
                    '<div class="notify_add_div" style="margin-top: 10px;margin-left: 10px;font-size: 16px">'+
                    '<input type="checkbox" name="check5" id="check5" checked="" value="5" class="noticeinput"> <label for="check5" style="margin-right: 12px;display: inline;font-size: 16px">公文正文</label>'+
                    '<input type="checkbox" name="check1" id="check1" checked="" value="1" class="noticeinput"> <label for="check1" style="margin-right: 12px;display: inline;font-size: 16px">表单</label>' +
                    '<input type="checkbox" name="check2" id="check2" checked="" value="2" class="noticeinput"> <label for="check2" style="margin-right: 12px;display: inline;font-size: 16px">公共附件</label>' +
                    '<input type="checkbox" name="check3" id="check3" checked="" value="3" class="noticeinput"> <label for="check3" style="margin-right: 12px;display: inline;font-size: 16px">会签与点评</label>' +
                    '<input type="checkbox" name="check4" id="check4" checked="" value="4" class="noticeinput"> <label for="check4" style="margin-right: 12px;display: inline;font-size: 16px">流程图</label>'+
                    '</div></div>',
                btn: ['确定', '取消'],
                yes: function(index){
                    var chk_value ='';
                    var runId = $.getQueryString("runId") || '';
                    $('.notify_add_div input[type="checkbox"]:checked').each(function(){
                        chk_value+=$(this).val();
                    });
                    window.open('/notice/newAndEdit?type=new&chkValue='+chk_value+'&runId='+runId);
                    layer.closeAll();
                },
                btn2: function() {
                    layer.closeAll();
                }
            });
        });
        // 更多操作 归档
        $('#guidang').click(function () {
            var a=null;
            var f = setInterval(function(){
                try{
                    a = $("#client").html();

                }catch(i){

                    clearInterval(f);
                }
                if(a){
                    clearInterval(f);
                    openFile(a)
                }
            },300);
        });
        // 更多操作-导出
        $('#daochu').click(function () {
            var a=null;
            a = $("#client").html();
            openFiledaochu(a)
        });
        //更多操作--内部邮件
        $('#mail').click(function () {
            layer.open({
                type: 1,
                skin: 'layui-layer-rim', //加上边框
                area: ['550px', '240px'], //宽高
                title:'邮件发送工作流信息 <span style="color:red;margin-left:15px"> 点击“确定”后，进入“写邮件”页面</span>',
                content:$('#share'),
                btn: ['确定', '取消'],
                yes:function (index) {
                    var flow_view_str="";
                    if($("#CHECK1").prop("checked"))
                        flow_view_str+="1,";
                    if($("#CHECK2").prop("checked"))
                        flow_view_str+="2,";
                    if($("#CHECK3").prop("checked"))
                        flow_view_str+="3,";
                    if($("#CHECK4").prop("checked"))
                        flow_view_str+="4,";
                    window.open('/email/addbox?flow_view_str='+flow_view_str);
                }
            })
        });
        //更多操作--转存
        $('#shareSave').click(function () {
            var flowname = $('#title .num').text()||'';
            var content = '<div id="shareDiv">\n' +
                '    <form action=""style="padding: 10px" method="post" name="form1"  action="">\n' +
                '        <table class="TableBlock" width="90%" align="center">\n' +
                '            <tbody>\n' +
                '                <tr>\n' +
                '                    <td>\n' +
                '                        <span class="shareDivTitle" style="font-size: 16px"> 请选择转存位置：</span>\n' +
                '                    </td>\n' +
                '                </tr>\n' +
                '                <tr class="shareDivCheck">\n' +
                '                    <td>\n' +
                '                        <input type="radio" name="shareDivCHECK" value="person" class="shareDivCHECK1" checked="true"> <span>个人文件柜</span>\n' +
                '                        <input type="radio" name="shareDivCHECK" value="public" class="shareDivCHECK2"> <span>公共文件柜</span>\n' +
                '                    </td>\n' +
                '                </tr>\n' +
                '                <tr class="shareDivChoose" style="display: none">\n' +
                '                    <td>\n' +
                '                        <div id="li_parent" class="easyui-tree ul_all tree" style="width: 100%;height: 150px;\n' +
                '    overflow-y: auto;"></div>'+
                '                        <div id="fileTree" class="easyui-tree ul_all tree" style="width: 100%;height: 150px;\n' +
                '    overflow-y: auto;"></div>'+
                '                    </td>\n' +
                '                </tr>\n' +
                '                <tr class="shareDivDown">\n' +
                '                    <td nowrap="" align="center" class="TableControl">\n' +
                '                        <input type="button" value="下一步" class="SmallButton" onclick="historyDown();">&nbsp;&nbsp;\n' +
                '                    </td>\n' +
                '                </tr>\n' +
                '                <tr class="TableData" style="display: none">\n' +
                '                    <td>转存文件名：<input type="text" name="SUBJECT" value="'+ flowname +'" class="SmallInput" size="40">\n' +
                '                    </td>\n' +
                '                </tr>\n' +
                '                <tr class="shareDivUp" style="display: none">\n' +
                '                    <td nowrap="" align="center" class="TableControl">\n' +
                '                        <input type="hidden" name="IS_VIEW" value="">\n' +
                '                        <input type="button" value="上一步" class="SmallButton" onclick="historyUP();">&nbsp;&nbsp;\n' +
                '                        <input type="button" value=" 转存 " class="SmallButton" onclick="turnFun();">&nbsp;&nbsp;\n' +
                '                    </td>\n' +
                '                </tr>\n' +
                '            </tbody>\n' +
                '        </table>\n' +
                '    </form>\n' +
                '</div>';
            layer.open({
                type: 1,
                skin: 'layui-layer-rim', //加上边框
                area: ['550px','450px'], //宽高
                title:'文件转存 — <span style="color:red;margin-left:15px"> '+ flowname +'.zip </span>',
                content:content,
                btn: ['取消'],
                scrollbar: true,
                success:function(){

                }
            })

        })
    
        // 一键下载文件
        $('#downloadFiles').click(function () {
            var fileIndex = layer.open({
                type: 1,
                id: 'downloadLayer',
                title: '文件下载',
                area: ['700px', '70%'],
                content: '<div>' +
                        '<div class="form_files">' +
                        '<h3 style="text-align: center;background-color: #d6e7f8;">' +
                        '<label style="position: absolute;left: 20px;font-size: 100%;margin: 0; line-height: 25px;"><input id="formFilesInputAll" onclick="checkFileInput(this, 0, 1)" type="checkbox" style="margin: 6px 5px;min-height: 13px;background-color: transparent;outline:none;">全选</label><span>表单文件</span>' +
                        '</h3><ul></ul>' +
                        '</div>' +
                        '<div class="common_files">' +
                        '<h3 style="text-align: center;background-color: #d6e7f8;">' +
                        '<label style="position: absolute;left: 20px;font-size: 100%;margin: 0; line-height: 25px;"><input id="commonFilesInputAll" onclick="checkFileInput(this, 0, 2)" type="checkbox" style="margin: 6px 5px;min-height: 13px;background-color: transparent;outline:none;">全选</label><span>公共文件</span>' +
                        '</h3><ul></ul>' +
                        '</div>' +
                        '<div class="main_files">' +
                        '<h3 style="text-align: center;background-color: #d6e7f8;">' +
                        '<label style="position: absolute;left: 20px;font-size: 100%;margin: 0; line-height: 25px;"><input id="mainFilesInputAll" onclick="checkFileInput(this, 0, 3)" type="checkbox" style="margin: 6px 5px;min-height: 13px;background-color: transparent;outline:none;">全选</label><span>正文文件</span>' +
                        '</h3><ul></ul>' +
                        '</div>' +
                        '</div>',
                btn: ['确定', '取消'],
                success: function () {
                    // 获取表单文件
                    var formFiles = $('#client').find('.imgfileBox');
                    var formFilesStr = '';
                    formFiles.each(function (i, v) {
                        var atturl = $(v).find('img').attr('atturl') || '';
                        if (!!atturl) {
                            var aId = getUrlString('AID', atturl);
                            var attachmentId = getUrlString('ATTACHMENT_ID', atturl);
                            var ym = getUrlString('YM', atturl);
                            var id = aId + '@' + ym + '_' + attachmentId;
                            var attachName = getUrlString('ATTACHMENT_NAME', atturl);
                            var module = getUrlString('MODULE', atturl);
                            formFilesStr += '<li style="line-height: 22px;"><input style="outline: none;" class="download_file_input form_files_input" onclick="checkFileInput(this, 1, 1)" type="checkbox" fileType="2" attachmentId="' + id + '" attachName="' + attachName + '" module="' + module + '" name=""/>' + attachName + '</li>';
                        }
                    })
                    if (!!formFilesStr) {
                        $('.form_files ul').html(formFilesStr);
                    } else {
                        $('#formFilesInputAll').parent().hide();
                        $('.form_files ul').html('<li style="line-height: 22px;">暂无文件</li>');
                    }
                    // 获取公共文件
                    var commonFileStr = '';
                    $.get('/workflow/work/findworkUpload', {
                        runId: $.getQueryString("runId"),
                        randomNum: Math.random()
                    }, function (res) {
                        if (res.flag) {
                            res.obj.forEach(function (file) {
                                var atturl = file.attUrl || '';
                                if (!!atturl) {
                                    var aId = getUrlString('AID', atturl);
                                    var attachmentId = getUrlString('ATTACHMENT_ID', atturl);
                                    var ym = getUrlString('YM', atturl);
                                    var id = aId + '@' + ym + '_' + attachmentId;
                                    var attachName = getUrlString('ATTACHMENT_NAME', atturl);
                                    var module = getUrlString('MODULE', atturl);
                                    commonFileStr += '<li style="line-height: 22px;"><input style="outline: none;" class="download_file_input common_files_input" onclick="checkFileInput(this, 1, 2)" type="checkbox" fileType="1" attachmentId="' + id + '" attachName="' + attachName + '" module="' + module + '" name=""/>' + attachName + '</li>';
                                }
                            })
                        }
                        if (!!commonFileStr) {
                            $('.common_files ul').html(commonFileStr);
                        } else {
                            $('#commonFilesInputAll').parent().hide();
                            $('.common_files ul').html('<li style="line-height: 22px;">暂无文件</li>');
                        }
                    })
                    // 获取正文文件
                    var mainFileStr = '';
                    $.get('/document/selectDocById', {
                        id: $.getQueryString("tabId"),
                        randomNum: Math.random(),
                        flowId: $.getQueryString('flowId')
                    }, function (res) {
                        if (res.flag) {
                            if (!!res.object.wordAttUrl) {
                                var fileStr = res.object.wordAttUrl;
                                var aId = getUrlString('AID', fileStr);
                                var attachmentId = getUrlString('ATTACHMENT_ID', fileStr);
                                var ym = getUrlString('YM', fileStr);
                                var id = aId + '@' + ym + '_' + attachmentId;
                                var attachName = getUrlString('ATTACHMENT_NAME', fileStr);
                                var module = getUrlString('MODULE', fileStr);
                                mainFileStr += '<li style="line-height: 22px;"><input style="outline: none;" class="download_file_input main_files_input" fileType="4" onclick="checkFileInput(this, 1, 3)" type="checkbox" attachmentId="' + id + '" attachName="' + attachName + '" module="' + module + '" name=""/>（留痕正文）' + attachName + '</li>';
                            }
                            if (!!res.object.aipAttUrl) {
                                var fileStr = res.object.aipAttUrl;
                                var aId = getUrlString('AID', fileStr);
                                var attachmentId = getUrlString('ATTACHMENT_ID', fileStr);
                                var ym = getUrlString('YM', fileStr);
                                var id = aId + '@' + ym + '_' + attachmentId;
                                var attachName = getUrlString('ATTACHMENT_NAME', fileStr);
                                var module = getUrlString('MODULE', fileStr);
                                mainFileStr += '<li style="line-height: 22px;"><input style="outline: none;" class="download_file_input main_files_input" fileType="6" onclick="checkFileInput(this, 1, 3)" type="checkbox" attachmentId="' + id + '" attachName="' + attachName + '" module="' + module + '" name=""/>（转版正文）' + attachName + '</li>';
                            }
                            if (!!res.object.mainOriginAttUrl) {
                                var fileStr = res.object.mainOriginAttUrl;
                                var aId = getUrlString('AID', fileStr);
                                var attachmentId = getUrlString('ATTACHMENT_ID', fileStr);
                                var ym = getUrlString('YM', fileStr);
                                var id = aId + '@' + ym + '_' + attachmentId;
                                var attachName = getUrlString('ATTACHMENT_NAME', fileStr);
                                var module = getUrlString('MODULE', fileStr);
                                mainFileStr += '<li style="line-height: 22px;"><input style="outline: none;" class="download_file_input main_files_input" fileType="3" onclick="checkFileInput(this, 1, 3)" type="checkbox" attachmentId="' + id + '" attachName="' + attachName + '" module="' + module + '" name=""/>（原始正文）' + attachName + '</li>';
                            }
        
                            if (!!res.object.mainClearAttUrl) {
                                var fileStr = res.object.mainClearAttUrl;
                                var aId = getUrlString('AID', fileStr);
                                var attachmentId = getUrlString('ATTACHMENT_ID', fileStr);
                                var ym = getUrlString('YM', fileStr);
                                var id = aId + '@' + ym + '_' + attachmentId;
                                var attachName = getUrlString('ATTACHMENT_NAME', fileStr);
                                var module = getUrlString('MODULE', fileStr);
                                mainFileStr += '<li style="line-height: 22px;"><input style="outline: none;" class="download_file_input main_files_input" fileType="5" onclick="checkFileInput(this, 1, 3)" type="checkbox" attachmentId="' + id + '" attachName="' + attachName + '" module="' + module + '" name=""/>（定稿正文）' + attachName + '</li>';
                            }
                        }
                        if (!!mainFileStr) {
                            $('.main_files ul').html(mainFileStr);
                        } else {
                            $('#mainFilesInputAll').parent().hide();
                            $('.main_files ul').html('<li style="line-height: 22px;">暂无文件</li>');
                        }
                    })
                },
                yes: function () {
                    var $checkFIles = $('.download_file_input:checked');
                    var dataArr = [];
                    $checkFIles.each(function (i, v) {
                        var attachmentId = $(v).attr('attachmentId') + ',';
                        var attachName = $(v).attr('attachName') + '*';
                        var module = $(v).attr('module');
                        var type = $(v).attr('fileType');
                        dataArr.push({
                            attachId: attachmentId,
                            attachName: attachName,
                            module: module,
                            type: type
                        })
                    })
                    
                    if (dataArr.length > 0) {
                        // var url = '/workflow/work/downLoadZipAtt?attachments=' + JSON.stringify(dataArr) + '&flowName=' + globalData.flowRun.runName;
                        //
                        // location.href = encodeURI(url).replace(/#/g, '%2523');
                        $.dynamicSubmit('/workflow/work/downLoadZipAtt', {
                            "attachments": JSON.stringify(dataArr),
                            "flowName": globalData.flowRun.runName
                        }, function () {
                            layer.close(fileIndex);
                        });
                    }
                }
            })
        });
        // 导出pdf
        $('.bak4').click(function () {
            var formWidth = $('.cont_form').find('.firstRow').parents('table').width();
            if(formWidth==0||formWidth==undefined){
                $('.other_module_box').width(1200);
            }else{
                $('.other_module_box').width(formWidth);
            }
            $('#client script').remove()
            //获取流水号
            var runId = $.GetRequest().runId||'';
            //获取表单的最长宽度
            var width;
            var height = $('.cont').height();
            if($('#a2 table').length == 1){
                width=$('#client #a2 table').width()

            }else{
                var arr = [];
                for(var i=0;i<$('#a2 table').length;i++){
                    arr.push($('#a2 table').eq(i).width());
                }
                width = arr.sort(sortNumber)[$('#a2 table').length-1];
            }
            if(width == undefined){
                width = '800'
            }
            var screenwidth = 1200;
            var tdwidth1 = screenwidth  * 0.20 +'px';
            var tdwidth2 = screenwidth  * 0.30 +'px';
            var tdwidth3 = screenwidth * 0.5 +'px';
            var tdwidth11 = screenwidth  * 0.08 +'px';
            var tdwidth22 = screenwidth  * 0.2 +'px';
            var tdwidth33 = screenwidth * 0.72 +'px';
            $('.trtd_d tr.this').eq(0).find('td').eq(0).css('width',tdwidth11);
            $('.trtd_d tr.this').eq(0).find('td').eq(1).css('width',tdwidth22);
            $('.trtd_d tr.this').eq(0).find('td').eq(2).css('width',tdwidth33)
            var $ele = $('<div>'+$('#client').html()+'</div>');
            $('.trtd_d tr.this').eq(0).find('td').eq(0).css('width',tdwidth1);
            $('.trtd_d tr.this').eq(0).find('td').eq(1).css('width',tdwidth2);
            $('.trtd_d tr.this').eq(0).find('td').eq(2).css('width',tdwidth3)
            $ele.find('.remove_sign').remove();
            $ele.find('.hoverbox').remove();
            $ele.find('.child_form_parentLink').hide().siblings('.preview').show();
            var divWidth=width-2;
            $ele.find('caption').after("<div class='caption' style='border: 1px dashed rgb(0, 0, 0);border-bottom: 0;margin:0 auto;width:"+divWidth+";'>"+$('caption').html()+"</div>").remove();

            var titleName='<img src="/img/spicon.png" style="position: absolute;top: 8px;left: 30px;">'+'<span style="display: inline-block;letter-spacing: 0.5px;margin-left: 43px;">导出PDF</span>';
            function empty() {
                $ele.find('.other_module_box').width('100%').find('td').css("border","1px solid #ddd");
                $ele.find('.other_module_box').find('th').css("border","1px solid #ddd");
                $ele.find('.caption').width('100%');
                $ele.find('#a2').width('100%').find('table').width('100%').find('td').css("width","").find('.preview').width('auto');
            }
            layer.open({
//                type: 1,
                /* skin: 'layui-layer-rim', //加上边框 */
//                    offset: '80px',
                area: ['330px', '260px'], //宽高
                title:titleName,
                content:'<table class="layerTable" cellpadding="0" cellspacing="0" style="border-collapse: collapse;margin: 0 auto;">' +
                '<tr>' +
                '<td><lable>纸张尺寸：</lable></td>' +
                '<td><select class="size" style="width:100px">' +
                '<option value="def">默认</option>' +
                '<option value="A4-endlong">A4纵向</option>' +
                '<option value="A4-cross">A4横向</option>' +
                '<option value="A3-endlong">A3纵向</option>' +
                '<option value="A3-cross">A3横向</option>' +
                '<option value="custom">自定义</option>' +
                '</select></td>' +
                '</tr>' +
                '<tr>' +
                '<td><lable style="display: block;padding-left: 30px;">宽度：</lable></td>' +
                '<td><input class="SWidth" style="width:60px" type="text"/>mm</td>' +
                '</tr>' +
                '<tr>' +
                '<td><lable style="display: block;padding-left: 30px;">高度：</lable></td>' +
                '<td><input class="SHeight" style="width:60px" type="text"/>mm</td>' +
                '</tr>' +
                '</table>',
                btn: ['确定', '取消'],
                success:function () {
                    $('.SWidth').val(width).attr("disabled","disabled")
                    $('.SHeight').val(height).attr("disabled","disabled")
                    $('.size').click(function () {
                        var sizeVal=$('.size').val();
                        switch (sizeVal) {
                            case 'def':
                                $('.SWidth').val(width).attr("disabled","disabled")
                                $('.SHeight').val(height).attr("disabled","disabled")
                                break;
                            case 'A4-endlong':
                                empty()
                                $('.SWidth').val(595).attr("disabled","disabled")
                                $('.SHeight').val(842).attr("disabled","disabled")
                                break;
                            case 'A4-cross':
                                empty()
                                $('.SWidth').val(842).attr("disabled","disabled")
                                $('.SHeight').val(595).attr("disabled","disabled")
                                break;
                            case 'A3-endlong':
                                empty()
                                $('.SWidth').val(842).attr("disabled","disabled")
                                $('.SHeight').val(1190).attr("disabled","disabled")
                                break;
                            case 'A3-cross':
                                empty()
                                $('.SWidth').val(1190).attr("disabled","disabled")
                                $('.SHeight').val(842).attr("disabled","disabled")
                                break;
                            case 'custom':
                                empty()
                                $('.SWidth').val(width).removeAttr("disabled")
                                $('.SHeight').val(height).removeAttr("disabled")
                                break;
                        }
                    })
                },
                yes: function(index){
                    $.ajax({
                        url:'/flowUtil/htmlFormToPDF',
                        type:'post',
                        data:{
                            htmlContent:$ele.html(),
                            module:'workflow',
                            runId:runId,
                            width:$('.SWidth').val(),
                            height:$('.SHeight').val()
                        },
                        dataType:'json',
                        success:function (data){
                            $('.other_module_box').width(1200);
                            if(data.flag){
                                if(data.object.attUrl&&data.object.attUrl.indexOf('&ATTACHMENT_NAME=') > -1){
                                    var attUrl = data.object.attUrl.split('&ATTACHMENT_NAME=')[0]+'&ATTACHMENT_NAME=&FILESIZE='+data.object.size;
                                    window.open('/download?'+attUrl);
                                }else{
                                    alert('接口报错，请联系厂商!');
                                }
                            }
                            layer.closeAll();
                        }
                    })
                }, btn2: function() {
                    $('.other_module_box').width(1200);
                    layer.closeAll();
                }
            })


        });
        // 导出word
        $('.bak5').click(function () {
            $('#client script').remove()
            $('.classBox').hide();
            $('.form_item[data-type="checkbox"]').show();
            $('.form_item[data-type="radio"]').show();
            //获取流水号
            var runId = $.GetRequest().runId||'';
            //获取表单的最长宽度
            var width;
            var height = $('.cont').height();
            if($('#a2 table').length == 1){
                width=$('#client #a2 table').width()

            }else{
                var arr = [];
                for(var i=0;i<$('#a2 table').length;i++){
                    arr.push($('#a2 table').eq(i).width());
                }
                width = arr.sort(sortNumber)[$('#a2 table').length-1];
            }
            if(width == undefined){
                width = '800'
            }
            

            /*************设置表单下列表与表单宽度一致START***************/
            var formWidth = $('.cont_form').find('.firstRow').parents('table').width();
            if(formWidth==0||formWidth==undefined){
                $('.other_module_box').width(1200);
            }else{
                $('.other_module_box').width(formWidth);
            }
            var $ele = $('<div>'+$('#client').html()+'</div>');
            $ele.find('.remove_sign').remove();
            $ele.find('.hoverbox').remove();
            $ele.find('.child_form_parentLink').hide().siblings('.preview').show();
            /*************设置表单下列表与表单宽度一致END***************/
            $.ajax({
                url:'/WorkFlowHtmlUtil/htmlToWord',
                type:'post',
                data:{
                    html:$ele.html(),
                    module:'workflow',
                    runId:runId,
                    width:width,
                    height:height
                },
                dataType:'json',
                success:function (data){
                    $('.other_module_box').width(1200);
                    $('.classBox').show();
                    $('.form_item[data-type="checkbox"]').hide();
                    $('.form_item[data-type="radio"]').hide();
                    if(data.flag){
                        if(data.object.attUrl&&data.object.attUrl.indexOf('&ATTACHMENT_NAME=') > -1){
                            var attUrl = data.object.attUrl.split('&ATTACHMENT_NAME=')[0]+'&ATTACHMENT_NAME=&FILESIZE='+data.object.size;
                            window.open('/download?'+attUrl);
                        }else{
                            alert('接口报错，请联系厂商!');
                        }
                    }
                }
            })
        });

        // 点击子流程跳转到详情页
        $(document).on('click', '.child_flow', function(){
            var url = $(this).data('url');
            $.popWindow(url);
        });

        // 查看分发情况
        $(document).on('click', '.opt_btn',function(){
            var optType = $(this).attr('optId');
            if (optType == 13) {
                layer.open({
                    type: 1,
                    skin: 'layui-layer-rim', //加上边框
                    area: ['550px', '240px'], //宽高
                    title:'公告通知工作流信息',
                    content: '<div style="padding: 10px">' +
                        '<h1 style="font-size: 16px">内容选择：</h1>'+
                        '<div class="notify_add_div" style="margin-top: 10px;margin-left: 10px;font-size: 16px">'+
                        '<input type="checkbox" name="check5" id="check5" checked="" value="5" class="noticeinput"> <label for="check5" style="margin-right: 12px;display: inline;font-size: 16px">公文正文</label>'+
                        '<input type="checkbox" name="check1" id="check1" checked="" value="1" class="noticeinput"> <label for="check1" style="margin-right: 12px;display: inline;font-size: 16px">表单</label>' +
                        '<input type="checkbox" name="check2" id="check2" checked="" value="2" class="noticeinput"> <label for="check2" style="margin-right: 12px;display: inline;font-size: 16px">公共附件</label>' +
                        '<input type="checkbox" name="check3" id="check3" checked="" value="3" class="noticeinput"> <label for="check3" style="margin-right: 12px;display: inline;font-size: 16px">会签与点评</label>' +
                        '<input type="checkbox" name="check4" id="check4" checked="" value="4" class="noticeinput"> <label for="check4" style="margin-right: 12px;display: inline;font-size: 16px">流程图</label>'+
                        '</div></div>',
                    btn: ['确定', '取消'],
                    yes: function(index){
                        var chk_value ='';
                        var runId = $.getQueryString("runId") || '';
                        $('.notify_add_div input[type="checkbox"]:checked').each(function(){
                            chk_value+=$(this).val();
                        });
                        window.open('/notice/newAndEdit?type=new&chkValue='+chk_value+'&runId='+runId);
                        layer.closeAll();
                    },
                    btn2: function() {
                        layer.closeAll();
                    }
                });
            } else if (optType == 15) {
                $.get('/operation/selFlowOperationById', {opId: optType}, function(json){
                    $.post('/' + json.object.useFunc, {id: globalData.flowRunPrcs.id, flag: 1}, function (res) {
                        if (res.flag) {
                            window.close();
                        }
                    });
                });
            } else {
                layui.use(['table', 'layer'], function () {
                    var table = layui.table;
                    var layer = layui.layer;
                    var title = '';
                    var path = '';
                    var $ele = '';
                    var area = [];
                    var tableIns = null;
                    var tableIns2 = null;
                    $.ajax({
                        url: '/operation/selFlowOperationById',
                        type: 'GET',
                        data: {opId: optType},
                        async: false,
                        success: function (res) {
                            if (res.flag) {
                                path = '/' + res.object.useFunc;
                                if (optType == 3) { // 查看分发情况
                                     tableIns = table.render({
                                        elem: '#dispensetable'
                                        , url: path + '?fromRunId=' + runId
                                        , page: false,
                                        toolbar: '<div class="layui-btn-container">\n' +
                                                '        <button class="layui-btn layui-btn-sm" lay-event="add">批量收回</button>\n' +
                                                '    </div>',
                                        defaultToolbar: []
                                        , height: 480
                                        , cols: [[
                                                {field: '', type: 'checkbox', align: 'center'},
                                            {field: 'receiveUnit', align: 'center', title: '接收单位'},
                                            {
                                                field: 'receiveStatus', align: 'center', title: '签收状态',
                                                templet: function (d) {
                                                    var str = ''
                                                    if (d.receiveStatus == 0) {
                                                        str = '待签收';
                                                    } else if (d.receiveStatus == 1) {
                                                        str = '已签收';
                                                    } else if (d.receiveStatus == 2) {
                                                        str = '已收回';
                                                    }else if (d.receiveStatus == 3) {
                                                        str = '已退回';
                                                    }
                                                    return str;
                                                }
                                            },
                                            {
                                                field: 'receiveTime', align: 'center', title: '接收时间',
                                                templet: function (d) {
                                                    if (d.receiveStatus == 0) {
                                                        return ''
                                                    } else if (d.receiveTime) {
                                                        return new Date(d.receiveTime).Format('yyyy-MM-dd hh:mm:ss');
                                                    } else {
                                                        return ''
                                                    }
                                                }
                                            },
                                            {
                                                field: 'fromTime', align: 'center', title: '发文时间',
                                                templet: function (d) {
                                                    return new Date(d.fromTime).Format('yyyy-MM-dd hh:mm:ss');
                                                }
                                            },
                                            {title: '操作', align: 'center', width: 100, toolbar: '#dispensetableBar'}
                                        ]]
                                        , response: {
                                            statusName: 'flag',
                                            statusCode: true,
                                            dataName: 'object'
                                        },
                                        done: function (res) {
                                            var data = res.object;
                                            var $ele = $('#dispensemodal .layui-table-main tr');
                                            data.forEach(function (item, index) {
                                                if (item.receiveStatus != '0') {
                                                    $ele.eq(index).find('td').eq(0).children().empty();
                                                }
                                            });
                                        }
                                    });
                                } else if (optType == 12) { // 联网查看签收情况
                                    tableIns2 = table.render({
                                        id: 'idTest',
                                        elem: '#dispensetable2'
                                        , url: path + '?runId=' + runId
                                        , page: false
                                        , toolbar: '#dispensetable2toolbar'
                                        , defaultToolbar: []
                                        , cols: [[
                                            {field: '', type: 'checkbox', align: 'center'},
                                            {field: 'deptNames', align: 'left', title: '接收单位部门'},
                                            {field: 'ounitNames', align: 'left', title: ' 接收单位名称'},
                                            {field: 'receiveStatus', align: 'left', title: '签收状态'},
                                            {
                                                field: 'sendTime', align: 'left', title: '发送时间',
                                                templet: function (d) {
                                                    if (d.sendTime) {
                                                        return new Date(d.sendTime).Format('yyyy-MM-dd hh:mm:ss');
                                                    } else {
                                                        return '';
                                                    }
                                                }
                                            },
                                            {
                                                field: 'receiveTime', align: 'left', title: '签收时间',
                                                templet: function (d) {
                                                    if (d.receiveTime) {
                                                        return new Date(d.receiveTime).Format('yyyy-MM-dd hh:mm:ss');
                                                    } else {
                                                        return '';
                                                    }
                                                }
                                            },
                                            {field: 'sendType', align: 'left', title: '发送类型'},
                                            {field: 'remark', align: 'left', title: '备注'},
                                            {fixed: 'right', title: '操作', align: 'left', toolbar: '#dispensetable2Bar'}
                                        ]]
                                        , response: {
                                            statusName: 'flag',
                                            statusCode: true,
                                            dataName: 'obj'
                                        },
                                        done: function (res) {
                                            var data = res.object;
                                            var $ele = $('#dispensemodal2 .layui-table-main tr');
                                            data.forEach(function (item, index) {
                                                if (item.receiveStatus == '已收回') {
                                                    $ele.eq(index).find('td').eq(0).children().empty();
                                                }
                                            });
                                        }
                                    });
                                }
                            }
                        }
                    });

                    if (optType == '3') {
                        title = '公文分发收文情况';
                        $ele = $('#dispensemodal');
                        area = ['70%', '600px'];
                    } else if (optType == '12') {
                        title = '联网查看签收情况';
                        $ele = $('#dispensemodal2');
                        area = ['90%', '600px'];
                    }

                    var layerIndex = layer.open({
                        title: title,
                        type: 1,
                        area: area,
                        content: $ele,
                        btn: ['关闭'],
                        yes: function () {
                            layer.close(layerIndex);
                        }
                    });
                    
                    //监听-表格-工具条
                    table.on('tool(dispensetable)', function (obj) {
                        var tData = obj.data;
                        var layEvent = obj.event;

                        if (layEvent === '1') {
                            var index = layer.confirm('确定收回本条流程？', {
                                btn: ['确定', '取消']
                            }, function (index) {
                                $.post('/documentExchangeReceive/recoverDoc', {receiveId: tData.receiveId+','}, function (res) {
                                    if (res.flag) {
                                        layer.msg(res.object);
                                        tableIns.reload();
                                        layer.close(index);
                                    }
                                });
                            });
                        }
                    });

                    //监听事件
                    table.on('toolbar(dispensetable)', function (obj) {
                        var checkStatus = table.checkStatus(obj.config.id);

                        if (obj.event == 'add') {
                            if (checkStatus.data.length === 0) {
                                layer.msg('请选择需要收回的数据!');
                                return false;
                            }
                            var receiveId = '';
                            checkStatus.data.forEach(function (item) {
                                receiveId += item.receiveId +',';
                            });
                            var index = layer.confirm('确定收回流程？', {
                                btn: ['确定', '取消']
                            }, function () {
                                $.post('/documentExchangeReceive/recoverDoc', {receiveId: receiveId}, function (res) {
                                    if (res.flag) {
                                        layer.msg(res.object);
                                        tableIns.reload();
                                        layer.close(index);
                                    }
                                });
                            });
                        }
                    });

                    //监听-表格-工具条
                    table.on('tool(dispensetable2)', function (obj) {
                        var tData = obj.data;
                        var layEvent = obj.event;

                        if (layEvent === '1') {
                            var index = layer.confirm('确定收回本条流程？', {
                                btn: ['确定', '取消']
                            }, function () {
                                var datas = [{
                                    recordId: tData.recordId,
                                    unitUnid: tData.unitUnid,
                                    docUnid: tData.docUnid
                                }];
                                $.post('/documentExchangeReceive/Regain', {datas: JSON.stringify(datas)}, function (res) {
                                    if (res.flag) {
                                        tableIns2.reload();
                                        layer.close(index);
                                    }
                                });
                            });
                        }
                    });

                    //监听事件
                    table.on('toolbar(dispensetable2)', function (obj) {
                        var checkStatus = table.checkStatus(obj.config.id);

                        if (obj.event == 'add') {
                            if (checkStatus.data.length === 0) {
                                layer.msg('请选择需要收回的数据!');
                                return false;
                            }
                            var datas = [];
                            checkStatus.data.forEach(function (item) {
                                var obj = {recordId: item.recordId, unitUnid: item.unitUnid, docUnid: item.docUnid}
                                datas.push(obj)
                            });
                            var index = layer.confirm('确定收回流程？', {
                                btn: ['确定', '取消']
                            }, function () {
                                $.post('/documentExchangeReceive/Regain', {datas: JSON.stringify(datas)}, function (res) {
                                    if (res.flag) {
                                        tableIns2.reload();
                                        layer.close(index);
                                    }
                                });
                            });
                        }
                    });
                });
            }
        });

        // 查看交办详情
        layui.use(['table', 'layer', 'upload', 'form'], function() {
            var table = layui.table,
                layer = layui.layer,
                upload = layui.upload,
                form = layui.form;
            var tableIns = null;

            //工作交办-附件上传
            upload.render({
                elem: '#test3'
                ,url: '/flowAssign/workUpload?module=flowassign' //上传接口
                ,accept: 'file' //普通文件
                ,done: function(res){
                    layer.msg('上传成功');
                    var data=res.obj[0];
                    var fileExtension=data.attachName.substring(data.attachName.lastIndexOf(".")+1,data.attachName.length);//截取附件文件后缀
                    var attName = encodeURI(data.attachName).replace(/\+/g, "%2b").replace(/\@/g,"%40").replace(/\#/g,"%23").replace(/\&/g,"%26").replace(/\//g,"%2F").replace(/\?/g,"%3F").replace(/\￥/g,"%ef%bf%a5").replace(/\$/g,"%24").replace(/\！/g,"%ef%bc%81").replace(/\（/g,"%ef%bc%88").replace(/\）/g,"%ef%bc%89").replace(/\…/g,"%e2%80%a6%e2%80%a6");
                    var fileExtensionName=attName.substring(0,attName.lastIndexOf("."));
                    var deUrl = data.attUrl.split('&ATTACHMENT_NAME=')[0]+"&ATTACHMENT_NAME="+fileExtensionName+"."+fileExtension+"&FILESIZE="+data.size;
                    var str = '<div class="dech" style="padding: 3px 0;" deUrl="' + deUrl+ '"><a href="/download?'+encodeURI(deUrl)+'" NAME="' + data.attachName + '*"><img style="margin-top: -3px; margin-right: 3px;" src="/img/attachment_icon.png"/>' + data.attachName + '</a><img class="deImgs" style="margin-left:5px;cursor: pointer;" src="/img/file/icon_deletecha_03.png"/><input type="hidden" data-attachname="'+data.attachName+'" class="inHidden" value="' + data.aid + '@' + data.ym + '_' + data.attachId + ',"></div>';

                    $('#demo2').append(str);
                }
            });

            //工作办理-附件上传
            upload.render({
                elem: '#test4'
                ,url: '/flowAssign/workUpload?module=flowassign' //上传接口
                ,accept: 'file' //普通文件
                ,done: function(res){
                    layer.msg('上传成功');
                    var data=res.obj[0];
                    var fileExtension=data.attachName.substring(data.attachName.lastIndexOf(".")+1,data.attachName.length);//截取附件文件后缀
                    var attName = encodeURI(data.attachName).replace(/\+/g, "%2b").replace(/\@/g,"%40").replace(/\#/g,"%23").replace(/\&/g,"%26").replace(/\//g,"%2F").replace(/\?/g,"%3F").replace(/\￥/g,"%ef%bf%a5").replace(/\$/g,"%24").replace(/\！/g,"%ef%bc%81").replace(/\（/g,"%ef%bc%88").replace(/\）/g,"%ef%bc%89").replace(/\…/g,"%e2%80%a6%e2%80%a6");
                    var fileExtensionName=attName.substring(0,attName.lastIndexOf("."));
                    var deUrl = data.attUrl.split('&ATTACHMENT_NAME=')[0]+"&ATTACHMENT_NAME="+fileExtensionName+"."+fileExtension+"&FILESIZE="+data.size;
                    var str = '<div class="dech" style="padding: 3px 0;" deUrl="' + deUrl+ '"><a href="/download?'+encodeURI(deUrl)+'" NAME="' + data.attachName + '*"><img style="margin-top: -3px; margin-right: 3px;" src="/img/attachment_icon.png"/>' + data.attachName + '</a><img class="deImgs" style="margin-left:5px;cursor: pointer;" src="/img/file/icon_deletecha_03.png"/><input type="hidden" data-attachname="'+data.attachName+'" class="inHidden" value="' + data.aid + '@' + data.ym + '_' + data.attachId + ',"></div>';

                    $('#demo3').append(str);
                }
            });

            initAssignmentTable();

            //监听-交办详情-表格-工具条
            table.on('tool(assignmenttable)', function(obj){
                var tData = obj.data;
                var layEvent = obj.event;

                if(layEvent === '1'){ // 工作办理
                    layer.open({
                        title: '工作办理',
                        type: 1,
                        area: ['600px', '370px'],
                        content: $('#workDone'),
                        btn: ['确定', '取消'],
                        success: function() {

                        }
                        ,yes: function () {
                            var neirong1 = $("#neirong1").val();
                            var flowId = globalData.flowRun.flowId;
                            var tipMsg = '您有新的公文需要办理，流水号：' + globalData.flowRun.runId + '，工作名称/文号：' + globalData.flowRun.runName;
                            var runId = $.GetRequest().runId;
                            var runName = globalData.flowRun.runName;
                            var tableName = $.GetRequest().tableName || '';
                            var tabId = $.GetRequest().tabId || '';
                            var smsType = '';
                            var attachmentId = '';
                            var attachmentName = '';

                            var $smsType = $('input[name="smstype"]:checkbox:checked', $('#workDone'));
                            $smsType.each(function(){
                                smsType += $(this).val() + ',';
                            });

                            var $attachments = $('#demo3').find('input[type="hidden"]');
                            $attachments.each(function(){
                                attachmentId += $(this).val();
                                attachmentName += $(this).data('attachname') + ',';
                            });

                            $.ajax({
                                type: 'get',
                                url: '/flowAssign/update',
                                dataType: 'json',
                                data: {
                                    taskFeedback:neirong1,
                                    flowId:flowId,
                                    smsType:smsType,
                                    smsContent:tipMsg,
                                    runId:runId,
                                    prcsId:globalData.flowRunPrcs.prcsId,
                                    currentPrcsId:globalData.flowProcesses.prcsId,
                                    fdAttachmentName: attachmentName,
                                    fdAttachmentID:attachmentId,
                                    assignId :tData.assignId,
                                    id:globalData.flowRunPrcs.id,
                                    runName: runName,
                                    tableName: tableName,
                                    tabId: tabId
                                },

                                success:function(res){
                                    if (res.flag) {
                                        tableIns.reload();
                                        layer.closeAll();
                                        $('#neirong1').val('');
                                        $('#demo3').empty();
                                    } else {
                                        $.layerMsg({content: '办理失败', icon: 2});
                                    }
                                }
                            })
                        },
                        btn2: function () {
                            layer.closeAll();
                            $('#neirong1').val('');
                            $('#demo3').empty();
                        },
                        cancel: function() {
                            layer.closeAll();
                            $('#neirong1').val('');
                            $('#demo3').empty();
                        }
                    });
                } else if(layEvent === '2'){ // 工作交办
                    layer.open({
                        title: '工作交办',
                        type: 1,
                        area: ['600px', '370px'],
                        content: $('#work'),
                        btn: ['确定', '取消'],
                        success: function() {

                            // if(globalData.feedback==0){
                            //     $("#yesr").attr("checked",true)
                            //     $("#nor").attr("disabled",false)
                            // }
                            // if(globalData.feedback==1){
                            //     $("#yesr").attr("checked",false)
                            //     $("#nor").attr("checked","checked")
                            // }
                            form.render();
                        }
                        ,yes: function () {
                            var neirong = '';//$("#neirong").val().trim();
                            var flowId = globalData.flowRun.flowId;
                            var runId = $.GetRequest().runId;
                            var thisrunName= $('.num').attr('thisrunName')||'';
                            var tableName = $.GetRequest().tableName|| '';
                            var viewUser = $('#viewUserName').attr('user_id') ||'';
                            var jingbanUser = $('#chargePerson').attr('user_id') || '';
                            var tipMsg = '您有新的公文需要办理，流水号：' + globalData.flowRun.runId + '，工作名称/文号：' + globalData.flowRun.runName;
                            var smsType1 = '';
                            var attachmentId = '';
                            var attachmentName = '';

                            // if (neirong == '') {
                            //     layer.msg('请选择填写交办内容！', {icon: 2});
                            //     return false;
                            // }

                            if (jingbanUser == '') {
                                layer.msg('请选择办理人！', {icon: 2});
                                return false;
                            }

                            var $smsType1 = $('input[name="smstype"]:checkbox:checked', $('#work'));
                            $smsType1.each(function(){
                                smsType1 += $(this).val() + ',';
                            });

                            var $attachments = $('#demo2').find('input[type="hidden"]');
                            $attachments.each(function(){
                                attachmentId += $(this).val();
                                attachmentName += $(this).data('attachname') + ',';
                            });

                            $.ajax({
                                type: 'get',
                                url: '/flowAssign/saveWork2',
                                dataType: 'json',
                                data: {
                                    assignId: tData.assignId,
                                    assignTask:neirong,
                                    flowId:flowId,
                                    runId:runId,
                                    thisrunName:thisrunName,
                                    jingbanUser:jingbanUser,
                                    viewUser:viewUser+',',
                                    prcsflag:1,
                                    prcsId:globalData.flowRunPrcs.prcsId,
                                    currentPrcsId:globalData.flowProcesses.prcsId,
                                    flowPrcs:globalData.flowRunPrcs.flowPrcs,
                                    signYn:globalData.feedback,
                                    prcsName:globalData.flowProcesses.prcsName,
                                    attachmentId: attachmentId,
                                    attachmentName: attachmentName,
                                    smsType:smsType1,
                                    smsContent:tipMsg,
                                    tableName: tableName,
                                    topFlag: globalData.flowRunPrcs.topFlag,
                                    parent: globalData.flowRunPrcs.parent
                                },

                                success:function(res){
                                    if (res.flag) {
                                        // 清空内容
                                        $('#neirong').val('');
                                        // 清空交办人
                                        $('#chargePerson').get(0).setAttribute('user_id', '');
                                        $('#chargePerson').val('');
                                        // 清空附件信息
                                        $('#demo2').empty();
                                        tableIns.reload();
                                        layer.closeAll();
                                    } else {
                                        $.layerMsg({content: '交办失败', icon: 2});
                                    }
                                }
                            });
                        },
                        btn2: function () {
                            layer.closeAll();
                            // 清空内容
                            $('#neirong').val('');
                            // 清空交办人
                            $('#chargePerson').get(0).setAttribute('user_id', '');
                            $('#chargePerson').val('');
                            // 清空附件信息
                            $('#demo2').empty();
                        },
                        cancel: function() {
                            layer.closeAll();
                            // 清空内容
                            $('#neirong').val('');
                            // 清空交办人
                            $('#chargePerson').get(0).setAttribute('user_id', '');
                            $('#chargePerson').val('');
                            // 清空附件信息
                            $('#demo2').empty();
                        }
                    });
                }
            });

            // 点击隐藏交办详情
            $('#closeAssignment').on('click', function(){
                $('#client').show();
                $('#assignmentDetail').hide();
            });

            // 工作办理、工作交办-删除附件
            $(document).on('click', '.deImgs',function(){
                var _this = this;
                var attUrl = $(this).parents('.dech').attr('deUrl');
                $.ajax({
                    type: 'get',
                    url: '/delete?'+attUrl,
                    dataType: 'json',
                    success:function(res){

                        if(res.flag == true){
                            layer.msg('删除成功', { icon:6});
                            $(_this).parent().remove();
                        }else{
                            layer.msg('删除失败', { icon:6});
                        }
                    }
                })
            });

            // 工作交办-获取办理人
            $('#userAdd').click(function(){
                user_id="chargePerson";
                $.popWindow("../../common/selectUser?0");
            });
            // 工作交办-清空办理人
            $('#delUser').click(function(){
                $('#chargePerson').get(0).setAttribute('user_id', '');
                $('#chargePerson').val('');
            });
            // 交办详情-附件查阅
            $(document).on('click','.yulan',function () {
                var url=$(this).attr('data-url');
                pdurl($.UrlGetRequest('?'+url),url);
            });
            $(document).on('click', '.chayue', function () {
                var url = $(this).attr('data-url');
                pdurl($.UrlGetRequest('?' + url), url);
            });

            // 交办选择意见
            $("#assignmentSign").click(function () {
                var signChooseLayer = layer.open({
                    title: '选择常用意见',
                    area: ['800px', '600px'],
                    type: 1,
                    content: '<div id="saveRule" >' +
                        '<div class="layui-form-item" style="margin: 10px 0 0 0;">' +
                        '<label class="layui-form-label" style="font-size: 13px; width: 100px;">添加常用意见：</label>' +
                        '<div class="layui-input-block" style="margin-left: 130px;">' +
                        '<input type="text" id="yijian" style="width: 300px" ><button type="button" style="font-size: 13px" class="add_fujianss" id="add">添加</button>' +
                        '<a style="margin-left:30px;margin-top:-13px;color:red;font-size: 13px;cursor:pointer;text-decoration: none;" id="up">删除常用意见</a>' +
                        '</div>' +
                        '</div>' +
                        '<div class="inputlayout" style="height: 440px; overflow: hidden;">' +
                        '<ul class="input_radio_box" style="height: 100%; overflow-y: auto;"></ul>' +
                        '</div>' +
                        '<hr>' +
                        '<div style="text-align: center;">' +
                        '<button type="button" style="margin: 0 10px;font-size: 13px" class="add_fujians" id="yes">选择</button>' +
                        '<button type="button" style="margin: 0 10px;font-size: 13px" class="add_fujians" id="cancle">取消</button>' +
                        '</div>' +
                        '</div>'
                    ,
                    success: function () {
                        $.get('/flowOpinion/selectFlowOpinion', function (res) {
                            var data = res.object
                            if (res.flag) {
                                if (res.object.length > 0) {
                                    var str = ''
                                    for (var i = 0; i < data.length; i++) {
                                        str += '<li class="clearfix" style="font-size: 13px;line-height: 20px;padding: 0 10px;"><input style="margin: -2px 5px 0 15px;" class="tableDl " id="flowId" data-id="' + data[i].opinionId + '"  type="radio" name="flowId" value="' + data[i].opinionContent + '" >' + data[i].opinionContent + '</li>'
                                    }
                                    $('.input_radio_box').html(str);
                                }
                            }
                        });
                        //数据回显
                        $("#yes", $('#saveRule')).click(function (event) {
                            var oldVal = $("#neirong").val();
                            var opinionContent = $('input[name="flowId"]:checked').val()

                            $("#neirong").val(oldVal+opinionContent);
                            layer.close(signChooseLayer);
                        })

                        //添加意见
                        $("#add", $('#saveRule')).click(function (event) {
                            var content = document.getElementById("yijian").value

                            $.ajax({
                                type: 'post',
                                url: '/flowOpinion/insertFlowOpinion',
                                dataType: 'json',
                                data: {
                                    opinionContent: content,
                                    opinionType: 1,

                                },
                                success: function (res) {
                                    if (res.flag) {
                                        $.get('/flowOpinion/selectFlowOpinion', function (res) {
                                            var data = res.object
                                            if (res.flag) {
                                                if (res.object.length > 0) {
                                                    var str = ''
                                                    for (var i = 0; i < data.length; i++) {
                                                        str += '<li class="clearfix" style="font-size: 13px;line-height: 20px;padding: 0 10px;"><input style="margin: -2px 5px 0 15px;" class="tableDl " id="flowId" data-id="' + data[i].opinionId + '"  type="radio" name="flowId" value="' + data[i].opinionContent + '" >' + data[i].opinionContent + '</li>'
                                                    }
                                                    $('.input_radio_box').html(str);
                                                }
                                            }
                                            $("#yijian").attr("value", "");

                                        });
                                    }
                                }
                            })
                        })

                        //删除意见
                        $("#up", $('#saveRule')).click(function () {
                            var opinionId = $('input[name="flowId"]:checked').data('id')

                            $.layerConfirm({title: '确定删除', content: '您确定要删除吗?', icon: 0}, function () {
                                $.ajax({
                                    type: 'post',
                                    url: '/flowOpinion/delFlowOpinion',
                                    dataType: 'json',
                                    data: {
                                        opinionId: opinionId,
                                    },
                                    beforeSend: function (request) {
                                        if (beforeToken != '') {
                                            request.setRequestHeader("Authorization", 'Bearer ' + beforeToken);
                                        }
                                    },
                                    success: function (res) {
                                        if (res.flag) {
                                            $.get('/flowOpinion/selectFlowOpinion', function (res) {
                                                var data = res.object
                                                if (res.flag) {
                                                    if (res.object.length > 0) {
                                                        var str = ''
                                                        for (var i = 0; i < data.length; i++) {
                                                            str += '<li class="clearfix" style="font-size: 13px;line-height: 20px;padding: 0 10px;"><input style="margin: -2px 5px 0 15px;" class="tableDl" id="flowId" data-id="' + data[i].opinionId + '"  type="radio" name="flowId" value="' + data[i].opinionContent + '" >' + data[i].opinionContent + '</li>'
                                                        }
                                                        $('.input_radio_box').html(str);
                                                    }
                                                }
                                            });
                                        } else {
                                            $.layerMsg({content: '请选择意见', icon: 2})
                                        }
                                    }
                                })
                            })
                        })

                        // 取消添加意见
                        $("#cancle", $('#saveRule')).click(function () {
                            layer.close(signChooseLayer)
                        })
                    }
                });
            });

            function initAssignmentTable() {
                tableIns = table.render({
                    elem: '#assignmenttable'
                    ,url: '/flowAssign/query?runId='+runId
                    ,page: false
                    ,cols: [[
                        {field: 'flowPrcs', align:'center', title: '步骤', width: 100,
                            templet: function (d) {
                                return '第' + d.flowPrcs + '步';
                            }
                        },
                        {field: 'prcsName', align:'center',title: '名称', width: 160},
                        {field: 'assignUserName', align:'center',title: '交办人', width: 100,
                            templet: function (d) {
                                return d.assignUserName + '<input class="parentassignid" type="hidden" value="'+d.parentAssignId+'"/>';
                            }
                        },
                        {field: 'handleUserName', align:'center',title: '办理人', width: 100},
                        // {field: 'assignTask', align:'center',title: '交办任务', minWidth: 100},
                        {field: 'handleStatus', align:'center',title: '状态', width: 100,
                            templet: function (d) {
                                var str = '未接收';
                                if (d.handleStatus == 1) {
                                    str = '办理中';
                                } else if (d.handleStatus == 2) {
                                    str = '办结';
                                }
                                return str;
                            }
                        },
                        {field: 'assignTime', align:'center',title: '交办时间', width: 150,templet: function(d){
                        // 格式化时间为 'YYYY/MM/DD mm:dd:ss'  否则ie下 new Date() 方法会出错
                                            var dateStr = d.assignTime.replace(/-/g,"/");
                                            return new Date(dateStr).Format('yyyy-MM-dd hh:mm');
                        }},
                        {field: 'attachmentName', align:'center',title: '交办文件', minWidth: 130,
                            templet: function (d) {
                                var attachmentList = d.attachment;
                                var str = ''
                                if (attachmentList.length > 0) {
                                    attachmentList.forEach(function(item){
                                        var fileExtension=item.attachName.substring(item.attachName.lastIndexOf(".")+1,item.attachName.length);//截取附件文件后缀
                                        var attName = encodeURI(item.attachName).replace(/\+/g, "%2b").replace(/\@/g,"%40").replace(/\#/g,"%23").replace(/\&/g,"%26").replace(/\//g,"%2F").replace(/\?/g,"%3F").replace(/\￥/g,"%ef%bf%a5").replace(/\$/g,"%24").replace(/\！/g,"%ef%bc%81").replace(/\（/g,"%ef%bc%88").replace(/\）/g,"%ef%bc%89").replace(/\…/g,"%e2%80%a6%e2%80%a6");
                                        var fileExtensionName=attName.substring(0,attName.lastIndexOf("."));
                                        var deUrl = item.attUrl.split('&ATTACHMENT_NAME=')[0]+"&ATTACHMENT_NAME="+fileExtensionName+"."+fileExtension+"&FILESIZE="+item.size;

                                        str+= '<div class="divShow"><a href="javascript:;" title="'+item.attachName+'" style="display: block; overflow: hidden;text-overflow: ellipsis;">'+item.attachName+'</a>' +
                                            '<div class="operationDiv">'+function(){
                                                if(fileExtension == 'pdf' || fileExtension == 'PDF'|| fileExtension == 'png' || fileExtension == 'PNG' || fileExtension == 'jpg' || fileExtension == 'JPG'|| fileExtension == 'txt'|| fileExtension == 'TXT') { //判断是否需要查阅
                                                    return '<a class="operation yulan"  href="javascript:void(0);" data-url="' + encodeURI(deUrl) + '" style="display: block; padding-left: 10px;"><img src="/img/attachmentIcon/icon_skim.png" style="margin-right: 5px;" alt="">查阅</a>'
                                                }else{
                                                    return '<a class="operation yulan"  href="javascript:void(0);" data-url="' + deUrl + '" style="display: block;padding-left: 10px;"><img src="/img/attachmentIcon/icon_skim.png" style="margin-right: 5px;" alt="">查阅</a>'
                                                }
                                            }()+
                                            '<a class="operation" style="display: block;padding-left: 10px;" href="/download?' + encodeURI(deUrl) + '"><img src="/img/attachmentIcon/icon_down.png" style="margin-right: 5px;" alt="">下载</a>'
                                            +'</div>' +
                                            '</div>'
                                    })
                                }
                                return str;
                            }
                        },
                        // {field: 'handleHour', align:'center',title: '时限', minWidth: 80},
                        // {field: 'receiveTime', align:'center',title: '任务接收时间', minWidth: 180},
                        {field: 'taskFeedback', align:'center',title: '办理汇报', minWidth: 130},
                        {field: 'fdAttachmentName', align:'center',title: '汇报文件', minWidth: 130,
                            templet: function (d) {
                                var attachmentList = d.fdAttachment;
                                var str = ''
                                if (attachmentList.length > 0) {
                                    attachmentList.forEach(function(item){
                                        var attachName = item.attachName;
                                        var fileExtension=attachName.substring(attachName.lastIndexOf(".")+1,attachName.length);//截取附件文件后缀
                                        var attName = encodeURI(attachName).replace(/\+/g, "%2b").replace(/\@/g,"%40").replace(/#/g,"%23").replace(/\&/g,"%26").replace(/\//g,"%2F").replace(/\?/g,"%3F").replace(/\￥/g,"%ef%bf%a5").replace(/$/g,"%24").replace(/\！/g,"%ef%bc%81").replace(/\（/g,"%ef%bc%88").replace(/\）/g,"%ef%bc%89").replace(/\…/g,"%e2%80%a6%e2%80%a6");
                                        var fileExtensionName=attName.substring(0,attName.lastIndexOf("."));
                                        var attachmentUrl = item.attUrl;
                                        attachmentUrl = attachmentUrl.substring(0,attachmentUrl.lastIndexOf("ATTACHMENT_NAME="))+"ATTACHMENT_NAME="+fileExtensionName+"."+fileExtension; //处理附件名字

                                        str+= '<div class="divShow"><a href="javascript:;" title="'+item.attachName+'" style="display: block; overflow: hidden;text-overflow: ellipsis;">'+item.attachName+'</a>' +
                                            '<div class="operationDiv">'+function(){
                                                if(fileExtension == 'pdf' || fileExtension == 'PDF'|| fileExtension == 'png' || fileExtension == 'PNG' || fileExtension == 'jpg' || fileExtension == 'JPG'|| fileExtension == 'txt'|| fileExtension == 'TXT') { //判断是否需要查阅
                                                    return '<a class="operation yulan"  href="javascript:void(0);" data-url="' + encodeURI(attachmentUrl) + '" style="display: block;padding-left: 10px;"><img src="/img/attachmentIcon/icon_skim.png" style="margin-right: 5px;" alt="">查阅</a>'
                                                }else{
                                                    return '<a class="operation yulan"  href="javascript:void(0);" data-url="' + attachmentUrl + '" style="display: block;padding-left: 10px;"><img src="/img/attachmentIcon/icon_skim.png" style="margin-right: 5px;" alt="">查阅</a>'
                                                }
                                            }()+
                                            '<a class="operation" style="display: block;padding-left: 10px;" href="/download?' + encodeURI(attachmentUrl) + '"><img src="/img/attachmentIcon/icon_down.png" style="margin-right: 5px;" alt="">下载</a>'
                                            +'</div>' +
                                            '</div>'
                                    })
                                }
                                return str;
                            }},
                        {fixed: 'right', title: '操作',align:'center', toolbar: '#assignmentBar', width: 120}
                    ]],
                    done: function(res) {
                        if (!res.flag) {
                            $('#assignmentDetail').hide();
                            return false;
                        }
                        $('#assignmentDetail').show();
                        $('.divShow').parent().css('height','auto');
                        $('.divShow').parent().css('overflow','visible');
                        $('#assignmentDetail .layui-table-main tr').last().find('.operationDiv').css('top', '-210%');
                        merge(res);
                    }
                    ,response: {
                        statusName: 'flag',
                        statusCode: true,
                        dataName: 'object'
                    }
                });
            }

            // 合并单元格方法
            function merge(res) {
                var data = res.object;
                var mergeIndex = 0;//定位需要添加合并属性的行数
                var mark = 1; //这里涉及到简单的运算，mark是计算每次需要合并的格子数
                var columsName = ['flowPrcs','prcsName', 'parentAssignId'];//需要合并的列名称
                var columsIndex = [0,1,2];//需要合并的列索引值

                var toolArr = $(".layui-table-fixed>.layui-table-body>.layui-table").find("tr");

                for (var k = 0; k < columsName.length; k++) { //这里循环所有要合并的列
                    var trArr = $(".layui-table-main>.layui-table").find("tr");//所有行
                    for (var i = 1; i < data.length; i++) { //这里循环表格当前的数据
                        var tdCurArr = trArr.eq(i).find("td").eq(columsIndex[k]);//获取当前行的当前列
                        var tdPreArr = trArr.eq(mergeIndex).find("td").eq(columsIndex[k]);//获取相同列的第一列
                        toolArr.eq(i-1).css({
                            height: function() {
                                return trArr.eq(i-1).height();
                            }
                        });
                        if (data[i][columsName[k]] === data[i-1][columsName[k]]) { //后一行的值与前一行的值做比较，相同就需要合并
                            if (k == 2 && (data[i]['flowPrcs'] != data[i-1]['flowPrcs'])) {
                                mergeIndex = i;
                                mark = 1;//一旦前后两行的值不一样了，那么需要合并的格子数mark就需要重新计算
                                continue;
                            }
                            mark += 1;
                            tdPreArr.each(function () {//相同列的第一列增加rowspan属性
                                $(this).attr("rowspan", mark);
                            });
                            tdCurArr.each(function () {//当前行隐藏
                                $(this).css("display", "none");
                            });
                        }else {
                            mergeIndex = i;
                            mark = 1;//一旦前后两行的值不一样了，那么需要合并的格子数mark就需要重新计算
                        }
                    }
                    mergeIndex = 0;
                    mark = 1;
                }
            }
        });

        if(isNomalType == 'false'){
            $('.officialDocument').height(document.documentElement.clientHeight-98);
//            $('.officialDocument').height($(document).height()-$('.head').height())
            $('.tabAB').show();
            $('.tabAB ul li').click(function () {
                if ($(this).attr('data-id') == 2) {
                    if(tabId != ''){
                        $.ajax({
                            url:'/syspara/selectTheSysPara?paraName=OFFICE_EDIT',
                            type:'post',
                            datatype:'json',
                            success: function (res) {
                                if(res.flag){
                                    if(res.object[0].paraValue == 0){
                                        //默认加载NTKO插件 进行跳转
                                        $('#zw').prop('src','/common/ntko?documentEditPriv=1&ntType=1&emailList=1&print=1&tabId='+tabId+'&tableName='+tableName+'&runId='+runId);
                                    }else{
                                        $('#zw').prop('src','/common/webOffice?documentEditPriv=1&ntType=1&emailList=1&print=1&tabId='+tabId+'&tableName='+tableName+'&runId='+runId);
                                    }
                                }else{
                                    $('#zw').prop('src','/common/webOffice?documentEditPriv=1&ntType=1&emailList=1&print=1&tabId='+tabId+'&tableName='+tableName+'&runId='+runId);
                                }
                            },
                            error:function(xhr){
                                $('#zw').prop('src','/common/webOffice?documentEditPriv=1&ntType=1&emailList=1&print=1&tabId='+tabId+'&tableName='+tableName+'&runId='+runId);
                            }
                        })
                    }
                }
            });
            $('.tabAB ul li').click(function () {
                $(this).siblings().removeClass('active');
                $(this).addClass('active');
                if($(this).attr('data-id')==1){
                    $('#client').show();
                    $('.officialDocument').hide()
                    $("#zw").contents().find("object").hide();
                }else {
                    $('#client').hide();
                    $('.officialDocument').show()
                    $("#zw").contents().find("object").show();
                }
            });
        }else{
            $('.opt').show();
            $('.step').show()
        };

        $('#tab_c').css('right',-($('#tab_c').width()));
        $('#tab_c').css('height',$('#tab_c').height()-$('.head').height()-$('.foot').height());
        $('#tab_c').css('top',$('.head').height());
        //引入方法
        workForm.init({
            formhtmlurl:'../../workflow/work/workfastAdd',//URL
            resdata:{
                flowId:flowId,
                runId:runId,
                flowStep:flowStep,
                prcsId:prcsId,
                tabId:tabId,
                tableName:tableName
            },
            prcsId:'',
            flowStep:'',//预览
            target:'.cont_form',
            preView:true
        },function (data,option) {
            globalData = data.object;
            if(data.object.flowRun.runId){
                var  titleName= 'NO.&nbsp'+data.object.flowRun.runId+'&nbsp;'+data.object.flowRun.runName;
                $('.num').html(titleName).attr('title',titleName);
            }
            //声明下签章、手写控件START
            if($('input[data-type=djsign]').length != 0){
                loadwebsign();
                function DWebSignSealFUN(){
                    SignLoadFlag = true;
                    for(var i=0;i<$('input[data-type=djsign]').length;i++){
                        sign_arr.push($('input[data-type=djsign]').eq(i).attr('name'));
                    }
                    DWebSignSeal = document.getElementById("DWebSignSeal");
                    LoadSignData(sign_arr);
                }
                DWebSignSealFUN()
            }
            //声明下评分控件START
            if($('.mark').length != 0){
                for(var i=0;i<$('.mark').length;i++){
                    var formItemId = $('.mark .form_item').eq(i).attr('name');
                    var value = $('.mark .form_item').eq(i).val();
                    scoreFun($("#startone"+formItemId));
                    if(value != '-1'){
                        $("#startone"+formItemId).find('a').eq(value).addClass('clibg');
                    }
                }
            }
            var obj2=data.object.listFp[0];
            var prcsFlag = data.object.flowRunPrcs.prcsFlag;

            var flowtype = prcsFlag == '1' ? '<fmt:message code="lang.th.will" />':(prcsFlag == '2' ?'<fmt:message code="lang.th.Process" />':(prcsFlag == '3'?'<fmt:message code="lang.th.Forwarded" />':'<fmt:message code="lang.th.HaveThrough" />'))
            /*************处理radio类型input在disabled下无法修改样式的问题 通过将已选中的radio 去除掉disabled解决 仅限于工作流-查看详情页面******************/
            var length = $('input[type=radio]').length;
            if(length != 0){
                for(var i=0;i<length;i++){
                    if($('input[type=radio]').eq(i).attr('checked') == 'checked'){
                        $('input[type=radio]').eq(i).removeAttr('disabled');
                    }
                }
            }

            /*************处理工作流表单过长，在表单设计器声明特殊标签进行控制START******************/
            if($('.splitBox').length > 0){
                $('head').append('<style>' +
                    '.splitTab li {\n' +
                    '    display: inline-block;\n' +
                    '    height: 45px;\n' +
                    '    min-width: 90px;\n' +
                    '}' +
                    '.active {\n' +
                    '    background: #3c92e5 !important;\n' +
                    '    border-radius: 4px;\n' +
                    '    color: #fff !important;\n' +
                    '}' +
                    '.head_title {\n' +
                    '    cursor:pointer;\n' +
                    '    display: inline-block;\n' +
                    '    margin: 7px 10px;\n' +
                    '    padding: 0 10px;\n' +
                    '    height: 30px;\n' +
                    '    line-height: 30px;\n' +
                    '    text-align: center;\n' +
                    '    font-size: 10pt;\n' +
                    '    border: 1px solid #3c92e5;\n' +
                    '    border-radius: 4px;\n' +
                    '    color: #3c92e5;\n' +
                    '}' +
                    '.head_title:hover {\n' +
                    '    border: 1px solid #3b8eef;\n' +
                    '    color: #ffffff;\n' +
                    '    background-color: #3b8eef;\n' +
                    '    background-image: -moz-linear-gradient(top, #3b8eef, #3b8eef);\n' +
                    '    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#3b8eef), to(#3b8eef));\n' +
                    '    background-image: -webkit-linear-gradient(top, #3b8eef, #3b8eef);\n' +
                    '    background-image: -o-linear-gradient(top, #3b8eef, #3b8eef);\n' +
                    '    background-image: linear-gradient(to bottom, #3b8eef, #3b8eef);\n' +
                    '    background-repeat: repeat-x;\n' +
                    '    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#3b8eef\', endColorstr=\'#3b8eef\', GradientType=0);\n' +
                    '    filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);\n' +
                    '}' +
                    '.splitTab{    ' +
                    '    width: 100%;\n' +
                    '    height: 50px;\n' +
                    '    position: fixed;\n' +
                    '    top: 45px;\n' +
                    '    z-index: 10000;\n' +
                    '    background: #fff;\n' +
                    '    display: none;' +
                    '}</style>'
                );
                var str = '';
                for(var i=0;i<$('.splitItem').length;i++){
                    var val = $('.splitItem').eq(i).attr('value');
                    str += '<li><span class="head_title">'+ val +'</span></li>'
                }
                if($('.splitItem').length > 0){
                    str += '<li><span class="head_title all">显示全部</span></li>'
                }
                $('.splitTab').html(str).show();
                $('.splitBox').hide().eq(0).show();
                $('.splitTab li span').eq(0).addClass('active');
                $('.splitTab').on('click','li',function(){
                    $(this).siblings().find('span').removeClass('active');
                    $(this).find('span').addClass('active');
                    if($(this).find('span').hasClass('all')){
                        $('.splitBox').show();
                    }else{
                        var num =  $(this).index();
                        $('.splitBox').eq(num).show().siblings().hide();
                    }
                });
            }else{
                //去除掉航天希尔项目，多标签表单会大面积隐藏控件得情况下，对于隐藏控件的处理
                for(var i=$('.form_item').length-1;i>-1;i--){
                    if($('.form_item').eq(i).is(':hidden')){
                        $('.form_item').eq(i).remove();
                    }
                }
            }
            /**************************************END*****************************************/
            /*********************处理checkbox和radio类型控件样式得问题开始*********************************************/
            if($('.form_item[type=checkbox]').length != 0){
                for(var i=0;i<$('.form_item[type=checkbox]').length;i++){
                    if($('.form_item[type=checkbox]').eq(i).is(':checked')){
                        $('.form_item[type=checkbox]').eq(i).hide().before('<span class="classBox"><span class="trueClass" style="display: inline-block;"></span></span>');
                    }else{
                        $('.form_item[type=checkbox]').eq(i).hide().before('<span class="classBox"></span>');
                    }
                }
            }
            if($('.form_item[type=radio]').length != 0){
                for(var i=0;i<$('.form_item[type=radio]').length;i++){
                    if($('.form_item[type=radio]').eq(i).is(':checked')){
                        $('.form_item[type=radio]').eq(i).hide().before('<span class="classBox radioBox"><span class="trueClass" style="display: inline-block;"></span></span>');
                    }else{
                        $('.form_item[type=radio]').eq(i).hide().before('<span class="classBox radioBox"></span>');
                    }
                }
            }
            /*********************处理checkbox和radio类型控件样式得问题结束*********************************************/
            printType['biaodan'] = true;
            if (data.object.flowProcesses) {
                var operationButton = data.object.flowProcesses.operationButton;
                if (operationButton && operationButton.length > 0) {
                    if (operationButton.lastIndexOf('3') > -1) {
                        $.get('/operation/selFlowOperationById?opId=3', function(res){
                            if (res.flag) {
                                var str = '<li class="opt_btn" optId='+res.object.opId+' style="width: auto;padding: 0 10px;"><img src="/img/workflow/flowsetting/'+res.object.picName+'.png" style="margin: -4px 5px 0 -5px;"><h1 style="display: inline-block;">'+res.object.opName+'</h1></li>'
                                $('.bak2').after(str);
                            }
                        });
                    }
                    if (operationButton.lastIndexOf('12') > -1) {
                        $.get('/operation/selFlowOperationById?opId=12', function(res){
                            if (res.flag) {
                                var str = '<li class="opt_btn" optId='+res.object.opId+' style="width: auto;padding: 0 10px;"><img src="/img/workflow/flowsetting/'+res.object.picName+'.png" style="margin: -4px 5px 0 -5px;"><h1 style="display: inline-block;">'+res.object.opName+'</h1></li>'
                                $('.bak2').after(str);
                            }
                        });
                    }

                    if (operationButton.lastIndexOf('13') > -1) {
                        $.get('/operation/selFlowOperationById?opId=13', function(res){
                            if (res.flag) {
                                var str = '<li class="opt_btn" optId='+res.object.opId+' style="width: auto;padding: 0 10px;"><img src="/img/workflow/flowsetting/'+res.object.picName+'.png" style="margin: -4px 5px 0 -5px;"><h1 style="display: inline-block;">'+res.object.opName+'</h1></li>'
                                $('.bak2').after(str);
                            }
                        });
                    }

                    if (operationButton.lastIndexOf('15') > -1) {
                        $.get('/operation/selFlowOperationById?opId=15', function(res){
                            if (res.flag && globalData.flowRunPrcs && globalData.flowRunPrcs.deliverTime) {
                                var str = '<li class="opt_btn" optId='+res.object.opId+' style="width: auto;padding: 0 10px;"><img src="/img/workflow/flowsetting/'+res.object.picName+'.png" style="margin: -4px 5px 0 -5px;"><h1 style="display: inline-block;">'+res.object.opName+'</h1></li>'
                                $('.bak2').after(str);
                            }
                        });
                    }
                }
            }
            if(location.href.indexOf('&type=email') > -1){
                $('#mail').click();
            }else if(location.href.indexOf('&type=notice') > -1){
                if($.getQueryString("btnType")=='13'){
                    $('#noticeBottom').click();
                }else{
                    $('#notify_add').click();
                }

            }else if(location.href.indexOf('&type=share') > -1){
                $('#shareSave').click();
            }
            $('.other_module_box').width(1200);

        });

        if(printBtn == 1){
            var tid = setInterval(function(){
                if(printType.biaodan&&printType.fujian&&printType.liucheng&&printType.huiqian){
                    clearInterval(tid);
                    if(printTypeNum.indexOf('1') == -1){
                        $('#dyform').removeAttr('checked');
                        $('#a2').hide();
                    }
                    if(printTypeNum.indexOf('2') == -1){
                        $('#dyfile').removeAttr('checked');
                        $('.theAttachment').hide();
                    }
                    if(printTypeNum.indexOf('3') == -1){
                        $('#dysign').removeAttr('checked');
                        $('.steptextcheck').hide();
                    }
                    if(printTypeNum.indexOf('4') == -1){
                        $('#dyflow').removeAttr('checked');
                        $('.steptextliucheng').hide();
                    }
                    $('#printPreView').click();
                }
            },1000);
        }
        $.post('/flowProcess/getFlowAttachment',{'runId':$.GetRequest().runId},function (json) {
            globalData['attach'] = [];
            if(json.flag){
                if(json.obj.length ==0){
                    $('.theAttachment').hide().html('');
                }else{
                    globalData['attach'] = json.obj;
                    var str='';
                    var screenwidth = document.documentElement.clientWidth;
                    var tdwidth1 = screenwidth * 0.7 * 0.57 +'px';
                    var tdwidth2 = screenwidth * 0.7 * 0.19 +'px';
                    var tdwidth3 = screenwidth * 0.7 * 0.19 +'px';
                    for(var i=0;i<json.obj.length;i++){
                        var priv = json.obj[i].aTTACH_PRIV;
                        if($.UrlGetRequest('?'+encodeURI(json.obj[i].attUrl)) != 'exe'&&$.UrlGetRequest('?'+encodeURI(json.obj[i].attUrl)) != 'rar'&&$.UrlGetRequest('?'+encodeURI(json.obj[i].attUrl)) != 'zip'&&$.UrlGetRequest('?'+encodeURI(json.obj[i].attUrl)) != 'key'&&$.UrlGetRequest('?'+encodeURI(json.obj[i].attUrl)) != 'numbers'&&$.UrlGetRequest('?'+encodeURI(json.obj[i].attUrl)) != 'pages'){
                            var style="";
                        }else{
                            var style="display:none;"
                        }
                        var v = json.obj[i];
                        var attachName = v.attachName;
                        var fileExtension=attachName.substring(attachName.lastIndexOf(".")+1,attachName.length);//截取附件文件后缀
                        var attName = encodeURI(attachName).replace(/\+/g, "%2b").replace(/\@/g,"%40").replace(/#/g,"%23").replace(/\&/g,"%26").replace(/\//g,"%2F").replace(/\?/g,"%3F").replace(/\￥/g,"%ef%bf%a5").replace(/$/g,"%24").replace(/\！/g,"%ef%bc%81").replace(/\（/g,"%ef%bc%88").replace(/\）/g,"%ef%bc%89").replace(/\…/g,"%e2%80%a6%e2%80%a6");
                        var fileExtensionName=attName.substring(0,attName.lastIndexOf("."));
                        var attachmentUrl = v.attUrl;
                        attachmentUrl = attachmentUrl.substring(0,attachmentUrl.lastIndexOf("ATTACHMENT_NAME="))+"ATTACHMENT_NAME="+fileExtensionName+"."+fileExtension; //处理附件名字

                        str+='<tr><td  align="center" style="width:'+ tdwidth1 +';">'+json.obj[i].attachName+' ' +
                            function(){
                                if(fileExtension == 'pdf' || fileExtension == 'PDF'|| fileExtension == 'png' || fileExtension == 'PNG' || fileExtension == 'jpg' || fileExtension == 'JPG'|| fileExtension == 'txt'|| fileExtension == 'TXT') { //判断是否需要查阅
                                    return '<a class="fileDownload yulan"  href="javascript:void(0);" data-url="' + encodeURI(attachmentUrl) + '" style="margin-left: 10px">查阅</a>'
                                }else{
                                    return '<a class="fileDownload chayue"  href="javascript:void(0);" data-url="' + attachmentUrl + '" style="margin-left: 10px">查阅</a>'
                                }
                            }()+' '+
                            function(){
                                if(priv !="" && priv.indexOf('4')>=0){
                                    return '<a class="download" url="/download?'+encodeURI(attachmentUrl)+'" href="javascript:void(0);" onclick="clickDownload($(this));">下载</a>'
                                }else{
                                    return ''
                                }
                            }() +
                            // '</td><td align="center" style="width:'+ tdwidth2 +';">'+ json.obj[i].fileSize +'</td><td align="center" style="width:'+ tdwidth3 +';">'+ json.obj[i].time +'</td></tr>'
                            '</td><td align="center" style="width:'+ tdwidth2 +';">'+ json.obj[i].fileSize +'</td></tr>'
                    }
                    $('.tr_tds tbody').html(str)
                    fujian()
                }
            }
            printType['fujian'] = true;
        },'json');

        $.post('/flowProcess/getFlowFeedBack',{'runId':$.GetRequest().runId},function (json) {
            if(json.flag){
                var arr=json.obj;
                if(arr.length == 0){
                    $('.steptextcheck').hide().html('');
                }else{
                    var str='';
                    var screenwidth = 1078;
                    var tdwidth1 = screenwidth * 0.7 * 0.57 +'px';
                    var tdwidth2 = screenwidth * 0.7 * 0.38 +'px';
                    for(var i=0;i<arr.length;i++){
                        str+=' <tr style="background: #fff;margin-top: 10px;">\
                        <td style="width:70%;"><p style="font-weight: bold"><fmt:message code="workflow.th.First" />'+arr[i].prcsId+'<fmt:message code="workflow.th.step" /> '+arr[i].prcsName+' '+arr[i].userName+function(){
                            if(arr[i].feedFlag == 2){
                                return '<span style="color: red;">（回退意见）</span>';
                            }else{
                                return '';
                            }
                        }()+'：</p> <p style="margin: 10px;">'+function(){
                            if(arr[i].content.indexOf('[')>=0&&arr[i].content.indexOf('[/')>=0){
                                arr[i].content=arr[i].content.replace(/\[.*?\]/g,'').replace(/\[\/.*?\]/g,'')
                            }
                            return arr[i].content
                        }()+'</p></td>\
                        <td style="width:30%;" align="right">'+arr[i].editTime+'</td>\
                    </tr>'
                    }
                    $('.steptextcheck table tbody').html(str);
                    huiqian();
                }
            }
            printType['huiqian'] = true;
        },'json');

        $.get('/flowProcess/getFlowRunPrecsAll',{'runId':$.GetRequest().runId},function (json) {
            if(json.flag){
                var designdata=json.datas;
                var str=' <tr style="line-height: 40px;">\n' +
                    '                        <th  nowrap="" class="th" colspan="3" align="center"><fmt:message code="workflow.th.TheProcessBegins" /></th>\n' +
                    '                    </tr>';
                var screenwidth = 1200;
                var tdwidth1 = screenwidth  * 0.20 +'px';
                var tdwidth2 = screenwidth  * 0.30 +'px';
                var tdwidth3 = screenwidth * 0.5 +'px';
                for(var i=0;i<designdata.length;i++){
                    if(i!=0){
                        tdwidth1 = '0px',tdwidth2 = '0px',tdwidth3 = '0px';
                    }
                    str += '<tr class="this" style="border-right: 1px solid #ddd" prcsId='+ designdata[i].prcsId +'>' +
                        '<td align="center" style="width: '+ tdwidth1 +';border-right: 1px solid #ddd"><fmt:message code="workflow.th.First" />' + (designdata[i].prcsId) + '<fmt:message code="workflow.th.step" /></td>' + /*第 步*/
                        '<td align="center" style="width: '+ tdwidth2 +';border-right: 1px solid #ddd"><img src="/img/arrow_down.gif" alt="">' + designdata[i].prcsName+function () {
                            if (designdata[i].backPrcsId != 0) {
                                return '<img style="margin-left: 5px;width: 18px;margin-bottom: 4px;" src="/img/workflow/work/htbtn.png">';
                            } else {
                                return ''
                            }
                        }() + '</td>' + /*序号*/
                        '<td align="left" style="width: '+ tdwidth3 +';"><img src="/img/workflow.gif" alt=""><a style=" color: red;text-decoration:underline" href="javascript:void(0)">' +
                        '' + designdata[i].userName + '&nbsp' + function () {
                            if (designdata[i].opFlag == 0) {
                                return '<fmt:message code="workflow.th.HandledBy" />'
                                /*经办*/
                            } else if (designdata[i].opFlag == 1) {
                                return '<fmt:message code="workflow.th.host" />'
                                /*主办*/
                            }
                        }() + '</a><span style="color: #00aa00;margin-left: 5px;">' + function () {
                            if (designdata[i].prcsFlag == 1) {
                                return '(<fmt:message code="lang.th.will" />)(<fmt:message code="workflow.th.ArriveTime" />：'+ designdata[i].arriveTime +'；<fmt:message code="document.th.handleTime" />：'+ designdata[i].handleTime
                                /*未接收*/
                            } else if (designdata[i].prcsFlag == 2) {
                                return '(<fmt:message code="lang.th.Process" />)(<fmt:message code="workflow.th.ArriveTime" />：'+ designdata[i].arriveTime +'；<fmt:message code="document.th.handleTime" />：'+ designdata[i].handleTime/*+designdata[i].handleTime办理中*/
                                /*办理中*/
                            } else if (designdata[i].prcsFlag == 3) {
                                return '(<fmt:message code="lang.th.Forwarded" />)(<fmt:message code="workflow.th.ArriveTime" />：'+ designdata[i].arriveTime +'；<fmt:message code="document.th.handleTime" />：'+ designdata[i].handleTime
                                /*转交下一步,用时*/
                            } else if (designdata[i].prcsFlag == 4) {
                                <%--return '<fmt:message code="lang.th.HaveThrough" />' + designdata[i].handleTime--%>
                                return '(<fmt:message code="lang.th.HaveThrough" />)(<fmt:message code="workflow.th.ArriveTime" />：'+ designdata[i].arriveTime +'；<fmt:message code="document.th.handleTime" />：'+ designdata[i].handleTime
                                /*已办结*/
                            } else if (designdata[i].prcsFlag == 5) {
                                return '<fmt:message code="workflow.th.FreeFlowPresettingSteps" />'
                                /*自由流程预设步骤*/
                            } else if (designdata[i].prcsFlag == 6) {
                                return '<fmt:message code="workflow.th.HasBeenSuspended" />'
                                /*已挂起*/
                            }
                        }() + function () {
                            if (designdata[i].prcsFlag == 1) {
                                return ')'
                            } else {
                                return ')</span><p><fmt:message code="workflow.th.ArriveTo" />：' + designdata[i].createTime + '</p>' + /*开始于*/
                                    '<p><fmt:message code="workflow.th.ReceiveTo" />：' + designdata[i].prcsTime + '</p><p><fmt:message code="workflow.th.DoTo" />：' + designdata[i].deliverTime + '</p></td>' + /*结束于*/
                                    '</tr>'
                            }
                        }() + ""
                }
                if(json.status){
                    str += '<tr style="background-color: #fff"><td colspan="3" style="padding: 20px;font-size: 15px;text-align: center;color: #2F5C8F;font-weight: bold;">流程结束</td></tr>'
                }
                if(parent == 'circulate'){
                    $('#title input[type=checkbox]').eq(3).click();
                    $('.trtd_d tbody').html('')
                }else{
                    $('.trtd_d tbody').html(str)
                }
                var prcsprcid = '';
                for(var i= 0;i<$('.trtd_d .this').length;i++){
                    var prcsid = $('.trtd_d .this').eq(i).attr('prcsid');
                    if(prcsid != prcsprcid){
                        if($('.trtd_d .this[prcsid='+ prcsid +']').length !=1){
                            var color = $('.trtd_d .this[prcsid='+ prcsid +']').eq(0).find('td').eq(0).css('background-color');
                            $('.trtd_d .this[prcsid='+ prcsid +']').eq(0).find('td').eq(0).attr('rowspan',$('.trtd_d .this[prcsid='+ prcsid +']').length);
                            for(var j=1;j<$('.trtd_d .this[prcsid='+ prcsid +']').length;j++){
                                $('.trtd_d .this[prcsid='+ prcsid +']').eq(j).find('td').eq(0).remove();
                                $('.trtd_d .this[prcsid='+ prcsid +']').eq(j).css('background-color',color);
                            }
                            prcsprcid = prcsid;
                        }
                    }
                }
                liucheng()
            }
            printType['liucheng'] = true;
        },'json');

        // 获取父子流程数据
        $.post('/workflow/work/prentAndSonFlow', {'runId': $.GetRequest().runId}, function (json) {
            var parentRunId = '';
            if (json.flag) {
                var str2 = '';
                if (json.object) {
                    parentRunId = json.object.runId;
                    $('.BigButtonCBox').show();
                    $('.BigButtonC').attr('onclick', 'form_view(' + json.object.runId + ',' + json.object.flowId + ')');
                    str2 += '<tr><td>父流程</td><td><a class="open_flow_work" style="color:#1687cb;text-decoration: underline;cursor: pointer;" flowId="' + json.object.flowId + '" runId="' + json.object.runId + '">' + json.object.runName + '</a></td></tr>';
                }
                if (json.obj.length != 0) {
                    $('.BigSelectBox').show();
                    var str = '<option value="" selected="">查看子流程表单</option>';
                    for (var i = 0; i < json.obj.length; i++) {
                        str += '<option value="' + json.obj[i].runId + ':' + json.obj[i].flowId + '">' + json.obj[i].runName + '</option>';
                        str2 += '<tr><td>子流程</td><td><a class="open_flow_work" style="color:#1687cb;text-decoration: underline;cursor: pointer;" flowId="' + json.obj[i].flowId + '" runId="' + json.obj[i].runId + '">' + json.obj[i].runName + '</a></td></tr>'
                    }
                    $('.BigSelect').html(str);
                }

                if (str2 != '') {
                    $('.connect_detail_content').append(str2);
                    $('#connectDetail').show();
                }
            }

            // 获取关联流程数据
            $.get('/flowRun/findrelationRunIds', {runId: $.GetRequest().runId + ','+parentRunId}, function (res) {
                if (res.flag) {
                    var str = '';
                    if (res.obj.length > 0) {
                        res.obj.forEach(function (item) {
                            str += '<tr><td>关联流程</td><td><a style="color: #1687cb;text-decoration: underline;" class="open_flow_work" title="' + item.runName + '" runId="' + item.runId + '" flowId="' + item.flowId + '" href="javascript:;">' + item.runName + '</a></td></tr>'
                        });
                    }
                    if (str != '') {
                        $('.connect_detail_content').append(str);
                        $('#connectDetail').show();
                    }
                }
            });
        }, 'json');

        $(document).on('click', '.open_flow_work', function(){
            var flowId = $(this).attr('flowid');
            var runId = $(this).attr('runid');
            $.popWindow('/workflow/work/workformPreView?flowId='+flowId+'&flowStep=&prcsId=&runId='+runId);
        });
        
        // 获取查阅情况
        $.get('/ToBeReadController/queryFileIsRead', {'runId': $.GetRequest().runId, 'prcsId': $.GetRequest().prcsId, 'flowPrcs': $.GetRequest().flowStep}, function(res){
            if (res.flag) {
                var str = '';
                if (res.data && res.data.length > 0) {
                    var data = res.data;
                    var readedUser = []
                    var unreadUserStr = []
                    for (var i = 0; i < data.length; i++) {
                        if (data[i].readFlag == 1) {
                            readedUser.push(data[i])
                        } else {
                            unreadUserStr.push(data[i].userName)
                        }
                    }
    
                    if (readedUser.length > 0) {
                        for (var i = 0; i < readedUser.length; i++) {
                            if (i == 0) {
                                str += '<tr><td>' + readedUser[i].userName + '</td><td>' + readedUser[i].readDate + '</td><td style="border-left: 1px solid #ddd;" rowspan="' + readedUser.length + '">' + unreadUserStr.join(',') + '</td></tr>';
                            } else {
                                str += '<tr><td>' + readedUser[i].userName + '</td><td>' + readedUser[i].readDate + '</td></tr>';
                            }
                        }
                    } else {
                        str = '<tr><td></td><td></td><td style="border-left: 1px solid #ddd;">' + unreadUserStr.join(',') + '</td></tr>';
                    }
                    
                    $('.read_detail_content').append(str);
                    $('#readDetail').show();
                }
            }
        });
        
    });

</script>
<script>
    //控制高度
    autodivheight();

    $('#bodys').show();

    window.onresize=autodivheight;

    $('#printPreView').click(function(){
        $('.head').hide();
        $('.foot').hide();
        var screenwidth = 1200;
        var tdwidth1 = screenwidth  * 0.20 +'px';
        var tdwidth2 = screenwidth  * 0.30 +'px';
        var tdwidth3 = screenwidth * 0.5 +'px';
        var tdwidth11 = screenwidth  * 0.08 +'px';
        var tdwidth22 = screenwidth  * 0.2 +'px';
        var tdwidth33 = screenwidth * 0.72 +'px';
        $('.trtd_d tr.this').eq(0).find('td').eq(0).css('width',tdwidth11);
        $('.trtd_d tr.this').eq(0).find('td').eq(1).css('width',tdwidth22);
        $('.trtd_d tr.this').eq(0).find('td').eq(2).css('width',tdwidth33)
        print_view();
        $('.trtd_d tr.this').eq(0).find('td').eq(0).css('width',tdwidth1);
        $('.trtd_d tr.this').eq(0).find('td').eq(1).css('width',tdwidth2);
        $('.trtd_d tr.this').eq(0).find('td').eq(2).css('width',tdwidth3)
        $('.head').show();
        $('.foot').show();
    });

    if (!!window.ActiveXObject || "ActiveXObject" in window){
        $('.bak3').show();
    }else{
        $('.bak3').hide();
    };

    function autodivheight(){
        var winHeight=0;
        if (window.innerHeight)
            winHeight = window.innerHeight;
        else if ((document.body) && (document.body.clientHeight))
            winHeight = document.body.clientHeight;
        if (document.documentElement && document.documentElement.clientHeight)
            winHeight = document.documentElement.clientHeight;
        winWidth = document.documentElement.clientWidth;

    };
    //打印预览
    function print_view() {
        window.focus();
        try{
            document.getElementById("WebBrowser").ExecWB(7,1);
        }catch(e){
            alert(e.description)
            alert("如不能打印预览，请调整安全级别！具体方法如下：根据当前页面所属安全区域，自定义安全设置，找到设置项“对未标记为可安全执行的脚本的Activex控件进行初始化并执行脚本”，将其设置为“提示”即可。");
        }
    };

    var newdate=new Date()
    var user_id='userDuser';
    var ireaeders;
    var editdatas;
    var subjectName,contentNo,createrd,contentValue1,contentValue2,contentValue3,atiachmentDesc,atiachmentName,atiachmentCont,crStartDate,crEndDate;
    var subject,sort_no,creaters,keyword1,keyword2,keyword3,attScript,attName,attContain,begainTime,endTime
    $(function(){
        // 查询提醒权限
        $.ajax({
            type:'get',
            url:'/smsRemind/getRemindFlag',
            dataType:'json',
            data:{
                type:16
            },
            success:function (res) {
                if(res.flag){
                    if(res.obj.length>0){
                        var data = res.obj[0];
                        // 是否默认发送
                        if(data.isRemind=='0'){
                            $('.remindCheck').prop("checked", false);
                        }else if(data.isRemind=='1'){
                            $('.remindCheck').prop("checked", true);
                        }
                        // 是否手机短信默认提醒
                        if(data.isIphone=='0'){
                            $('.smsDefault').prop("checked", false);
                        } else if (data.isIphone=='1'){
                            $('.smsDefault').prop("checked", true);
                        }
                        // 是否允许发送事务提醒
                        if(data.isCan=='0'){
                            $('.remindCheck').prop("checked", false);
                            $('.smsDefault').prop("checked", false);
                            $('.remindCheck').parent('div').hide();
                        }

                    }
                }
            }
        })
        var index = true;
        var Height=$('body').height()-2;
        $('.cabinet_left').height(Height);

        //鼠标移入附件名显示附件操作
        $('#file_Tachr').on('mouseover','.divShow',function () {
            $(this).find('.operationDiv').show();
        })
        $('#file_Tachr').on('mouseout','.divShow',function () {
            $(this).find('.operationDiv').hide();
        })
        $('#file_Tachrs').on('mouseover','.divShow',function () {
            $(this).find('.operationDiv').show();
        })
        $('#file_Tachrs').on('mouseout','.divShow',function () {
            $(this).find('.operationDiv').hide();
        })

        //新建文件
        $('#contentAdd').click(function(){
            var sortId=$('input[name="folderId"]').val();
            var sortText=$('input[name="sortTxt"]').val();
            var idea=$('input[name="folderId"]').attr('ireader');
            $.popWindow('/newFilePub/newFiles?sortId='+sortId+'&text='+encodeURI(sortText)+'&idea='+idea+'&ie_open=yes','<fmt:message code="global.lang.new"/>','100','300','960px','700px');
        })

        //全选点击事件
        $('#checkedAll').click(function(){
            var state =$(this).prop("checked");
            if(state==true){
                $(this).prop("checked",true);
                $(".checkChild").prop("checked",true);
                $(".contentTr").addClass('bgcolor');
                $('#singReading').removeClass('addBackground');
                $('#copy').removeClass('copyfile');
                $('#shear').removeClass('copyfile');
                $('#paste').removeClass('copyfile');
                $('#deletebtn').removeClass('addBackground');
            }else{
                $(this).prop("checked",false);
                $(".checkChild").prop("checked",false);;
                $('.contentTr').removeClass('bgcolor');
                $('#singReading').addClass('addBackground');
                $('#copy').addClass('copyfile');
                $('#shear').addClass('copyfile');
                $('#paste').addClass('copyfile');
                $('#deletebtn').addClass('addBackground');
            }
        })
        $('#checkedAlls').click(function(){
            var state =$(this).prop("checked");
            if(state==true){
                $(this).prop("checked",true);
                $(".checkChildren").prop("checked",true);
                $(".contentTrs").addClass('bgcolor');
                $('#queryDelete').removeClass('addBackground');

            }else{
                $(this).prop("checked",false);
                $(".checkChildren").prop("checked",false);;
                $('.contentTrs').removeClass('bgcolor')
                $('#queryDelete').addClass('addBackground');
            }
        })
        $('#checkedAllY').click(function(){
            var state =$(this).prop("checked");
            if(state==true){
                $(this).prop("checked",true);
                $(".checkChildren").prop("checked",true);
                $(".contentT").addClass('bgcolor');
                $('#deleteAll').removeClass('addBackground');
            }else{
                $(this).prop("checked",false);
                $(".checkChildren").prop("checked",false);;
                $('.contentT').removeClass('bgcolor');
                $('#deleteAll').addClass('addBackground');
            }
        })
        //删除点击事件
        $('#deletebtn').click(function(){
            if($('#deletebtn').hasClass('addBackground')){
                return false
            }
            //var TYPE=$('.w .trBtn').attr('TYPE');
            var id=$('.w .contentTr').attr('sortId');
            var idea=$('input[name="folderId"]').attr('ireader');
            var fileId=[];
            $(".checkChild:checkbox:checked").each(function(){
                var conId=$(this).attr("conId")
                fileId.push(conId);
            })
            if(fileId == ''){
                $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:2});
            }else{
                dataDelete(fileId,id,idea)
                $('#paste').addClass('addBackground');
            }
        })
        //查询列表删除事件
        $('#queryDelete').click(function(){
            if($('#queryDelete').hasClass('addBackground')){
                return false
            }
            var sortId=$('.w .contentTr').attr('sortId');
            var userId=$('#userDuser').attr('user_id');
            var fileId=[];
            $(".checkChildren:checkbox:checked").each(function(){
                var conId=$(this).attr("conId")
                fileId.push(conId);
            })
            if(fileId == ''){
                $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:2});
            }else{
                $('.details').show().siblings().hide();
                dataDeleteOne(fileId,sortId,userId)
            }
        })
        //全局搜索列表删除事件
        $('#deleteAll').click(function(){
            if($('#deleteAll').hasClass('addBackground')){
                return false
            }
            var userId=$('#userDuser').attr('user_id');
            var fileId=[];
            $(".checkChildren:checkbox:checked").each(function(){
                var conId=$(this).attr("conId")
                fileId.push(conId);
            })
            if(fileId == ''){
                $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:2});
            }else{
                $('.queryDetail').show().siblings().hide();
                dataDeleteAll(fileId,userId)
            }
        })
        //文件详情点击事件
        $('.w').on('click','.TITLE',function(){
            var that=$(this);
            var idT=$(this).parents('tr').attr('contentId');
            var sortId=$(this).parents('tr').attr('sortId');
            var dataIsRead=$(this).parents('tr').attr('data-isread');
            var deleteNum=$('input[name="deleteQuanxian"]').val();
            var exportNum=$('input[name="exportQuanxian"]').val();
            var editNum=$('input[name="editQuanxian"]').val();
            var riderNum=$('input[name="qianyueQuanxian"]').val();
            var reviewNum=$('input[name="reviewQuanxian"]').val()
            if(dataIsRead == '0'){
                $.ajax({
                    type:'post',
                    url:'/newFileContent/readFile',
                    dataType:'json',
                    data:{'contentId':idT},
                    success:function(res){
                        if(res.flag){
                            that.siblings('img').remove();
                        }else{
                            $.layerMsg({content:'签阅失败！',icon:2});
                        }
                    }
                })
            }
            $(this).children('img').hide();
            $.popWindow('/newFilePub/fileDetail?contentId='+idT+'&sortId='+sortId+'&deleteNum='+deleteNum+'&exportNum='+exportNum+'&editNum='+editNum+'&riderNum='+riderNum+'&reviewNum='+reviewNum,'<fmt:message code="file.th.detail"/>','100','150','1000px','500px');

        })
        //编辑点击事件
        $('.w').on('click','.editBtn',function(){
            var idT=$(this).parents('tr').attr('contentId');
            var sortId=$(this).parents('tr').attr('sortId');
            var contype=$(this).parents('tr').attr('conType');
            var idea=$('input[name="folderId"]').attr('ireader');
            $.popWindow('/newFilePub/newFiles?contentId='+idT+'&sortId='+sortId+'&contype='+contype+'&idea='+idea+'&ie_open=yes','<fmt:message code="global.lang.edit"/>','0','0','1500px','800px');
        })
        //签阅情况点击事件
        $('#file_Tachr').on('click','.signReading',function(){
            var idT=$(this).parents('tr').attr('contentId');
            $.popWindow('/newFilePub/signReading?contentId='+idT,'<fmt:message code="global.lang.edit"/>','50','100','1000px','700px');
        })

        //查询签阅情况点击事件
        $('#file_Tach').on('click','.signReading',function(){
            var idT=$(this).parents('tr').attr('contentId');
            $.popWindow('/newFilePub/signReading?contentId='+idT,'<fmt:message code="global.lang.edit"/>','50','100','1000px','700px');
        })
        //全局查询签阅情况点击事件
        $('#file_Tachrs').on('click','.signReading',function(){
            var idT=$(this).parents('tr').attr('contentId');
            $.popWindow('/newFilePub/signReading?contentId='+idT,'<fmt:message code="global.lang.edit"/>','50','100','1000px','700px');
        })

        //弹出一个页面层，查询点击事件
        $('.SEARCH').on('click', function(event){
            event.stopPropagation();
            var sortId=$('.contentTr').attr('sortId');
            var idea=$('input[name="folderId"]').attr('ireader');
            layer.open({
                type: 1,
                title:['<fmt:message code="global.lang.query"/>', 'background-color:#2b7fe0;color:#fff;'],
                area: ['700px', '460px'],
                shadeClose: true, //点击遮罩关闭
                btn: ['<fmt:message code="global.lang.query"/>', '<fmt:message code="global.lang.close"/>'],
                content: '<table cellspacing="0" cellpadding="0" class="tab" style="border-collapse:collapse;background-color: #fff;width: 98%;">' +
                    '<tr><td><fmt:message code="file.th.TitleContainsText"/>：</td><td><input type="text" style="width: 150px;" name="subjectName" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.Sort"/>：</td><td><input type="text" style="width: 150px;" name="contentNo" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.builder"/>：</td><td><div class="inPole"><textarea name="txt" id="userDuser" user_id="id" value="admin" disabled style="min-width: 300px;min-height:50px;"></textarea><span class="add_img" style="margin-left: 10px"><a href="javascript:;" id="selectUser" class="Add "><fmt:message code="global.lang.add"/></a></span></div></td></tr>'+
                    '<tr><td><fmt:message code="file.th.Keywords1"/>：</td><td><input type="text" style="width: 150px;" name="contentValue1" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.keyword2"/>：</td><td><input type="text" style="width: 150px;" name="contentValue2" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.keyword3"/>：</td><td><input type="text" style="width: 150px;" name="contentValue3" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.text"/>：</td><td><input type="text" style="width: 150px;" name="atiachmentDesc" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.fileName"/>：</td><td><input type="text" style="width: 150px;" name="atiachmentName" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.containsText"/>：</td><td><input type="text" style="width: 150px;" name="atiachmentCont" class="inputTd" value="" /><span style="margin-left: 10px;color:#999;font-size:9pt;"><fmt:message code="file.th.Only"/></span></td></tr>'+
                    '<tr><td><fmt:message code="global.lang.date"/>：</td><td><input type="text" style="width: 150px;" name="crStartDate" id="start" class="inputTd" value="" onclick="laydate(start)" /><span style="font-size:9pt;margin:0 5px;"><fmt:message code="global.lang.to"/></span><input type="text" style="width: 150px;" name="crEndDate" id="end" class="inputTd" value="" onclick="laydate(end)" /></td></tr>'+
                    '</table>',
                yes:function(index){
                    var userId=$('#userDuser').attr('user_id');
                    if(userId=='id'){
                        userId='';
                    }
                    subjectName=$('input[name="subjectName"]').val();
                    contentNo=$('input[name="contentNo"]').val()
                    createrd=$('#userDuser').attr('user_id');
                    contentValue1=$('input[name="contentValue1"]').val()
                    contentValue2=$('input[name="contentValue2"]').val()
                    contentValue3=$('input[name="contentValue3"]').val()
                    atiachmentDesc=$('input[name="atiachmentDesc"]').val()
                    atiachmentName=$('input[name="atiachmentName"]').val()
                    atiachmentCont=$('input[name="atiachmentCont"]').val()
                    crStartDate=$('input[name="crStartDate"]').val()
                    crEndDate=$('input[name="crEndDate"]').val()
                    queryOneData(sortId,userId,idea);
                    layer.close(index);
                    $('.mainContent').hide();
                    $('.details').show();
                },
            });
            $('#selectUser').click(function(){
                user_id='userDuser';
                $.popWindow("../common/selectUser");
            })

        });

        //点击全局搜索按钮
        $('#overall').on('click', function(event){
            event.stopPropagation();
            var sortId=$('.contentTr').attr('sortId');
            layer.open({
                type: 1,
                title:['<fmt:message code="Email.th.global"/>', 'background-color:#2b7fe0;color:#fff;'],
                area: ['600px', '460px'],
                shadeClose: true, //点击遮罩关闭
                btn: ['<fmt:message code="global.lang.query"/>', '<fmt:message code="global.lang.close"/>'],
                content: '<table cellspacing="0" cellpadding="0" class="tab" style="border-collapse:collapse;background-color: #fff;width: 94%;">' +
                    '<tr><td><fmt:message code="file.th.TitleContainsText"/>：</td><td><input type="text" style="width: 150px;" name="subject" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.Sort"/>：</td><td><input type="text" style="width: 150px;" name="sort_no" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.builder"/>：</td><td><div class="inPole"><textarea name="txt" id="userDuser" user_id="id" value="admin" disabled style="min-width: 300px;min-height:50px;"></textarea><span class="add_img" style="margin-left: 10px"><a href="javascript:;" id="selectUser" class="Add "><fmt:message code="global.lang.add"/></a></span></div></td></tr>'+
                    '<tr><td><fmt:message code="file.th.Keywords1"/>：</td><td><input type="text" style="width: 150px;" name="keyword1" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.keyword2"/>：</td><td><input type="text" style="width: 150px;" name="keyword2" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.keyword3"/>：</td><td><input type="text" style="width: 150px;" name="keyword3" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.text"/>：</td><td><input type="text" style="width: 150px;" name="attScript" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.fileName"/>：</td><td><input type="text" style="width: 150px;" name="attName" class="inputTd" value="" /></td></tr>'+
                    '<tr><td><fmt:message code="file.th.containsText"/>：</td><td><input type="text" style="width: 150px;" name="attContain" class="inputTd" value="" /><span style="margin-left: 10px;color:#999;font-size:9pt;"><fmt:message code="file.th.Only"/></span></td></tr>'+
                    '<tr><td><fmt:message code="global.lang.date"/>：</td><td><input type="text" style="width: 150px;" name="begainTime" id="start" class="inputTd" value="" onclick="laydate(start)" /><span style="font-size:9pt;margin:0 5px;"><fmt:message code="global.lang.to"/></span><input type="text" style="width: 150px;" name="endTime" id="end" class="inputTd" value="" onclick="laydate(end)" /></td></tr>'+
                    '</table>',
                success:function(){

                },
                yes:function(index){
                    var userId=$('#userDuser').attr('user_id');
                    if(userId=='id'){
                        userId='';
                    }
                    subject=$('input[name="subject"]').val();
                    sort_no=$('input[name="sort_no"]').val()
                    creaters=$('#userDuser').attr('user_id');
                    keyword1=$('input[name="keyword1"]').val()
                    keyword2=$('input[name="keyword2"]').val()
                    keyword3=$('input[name="keyword3"]').val()
                    attScript=$('input[name="attScript"]').val()
                    attName=$('input[name="attName"]').val()
                    attContain=$('input[name="attContain"]').val()
                    begainTime=$('input[name="begainTime"]').val()
                    endTime=$('input[name="endTime"]').val();
                    sortId='';
                    contentId='';
                    queryAllData(userId);
                    layer.close(index);
                    $('.mainContent').hide();
                    $('.queryDetail').show();
                },
            });
            $('#selectUser').click(function(){
                user_id='userDuser';
                $.popWindow("../common/selectUser");
            })

        });
        //数据列表返回点击事件
        $('.backBtn').click(function(){
            $('.contentTrs').remove();
            $('.mainContent').show();
            $('.details').hide();
            $('.queryDetail').hide();
            $('#noFile').hide();
        })
//    var conId;
        var copyIds='';
        var copyfileId = "";
        var state="";
        var copyCon = 0;
        //复制点击事件
        $('#copy').click(function(){
            copyIds=""
            if($('#copy').hasClass('copyfile')){
                copyfileId = $('.tree-node-selected').attr('node-id');
                state = 'one'
            }else{
                //        conId=$('.bgcolor').attr('contentid');
                copyCon = 1;
                $('#copyAndShear').attr('sortId','1');
                var zhantieVal=$('input[name="zhantieQuanxian"]').val();
                $(".checkChild:checkbox:checked").each(function(){
                    copyIds+=$(this).attr("conid")+',';
                })
                if(copyIds == ''){
                    $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:2});
                }else{
                    $.layerMsg({content:'<fmt:message code="doc.th.SelectedFile"/>！',icon:1});
                }
            }

        })
        //剪切点击事件
        var fileIds='';
        var orgSortId='';
        $('#shear').click(function(){
            orgSortId=$('.spanFolder').attr('data-id');
            if($('#shear').hasClass('copyfile')){
                copyfileId = $('.tree-node-selected').attr('node-id');
                state = 'two'
            }else{
                copyCon = 1;
                $('#copyAndShear').attr('sortId','2');
                $(".checkChild:checkbox:checked").each(function(){
                    fileIds+=$(this).attr("conId")+',';
                })
                if(fileIds == ''){
                    $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:2});
                }else{
                    $.layerMsg({content:'<fmt:message code="doc.th.SelectedFile"/>！',icon:1});
                    $('#paste').show();
                }
            }

        })
        //粘贴点击事件
        $('#paste').click(function(){
            if(copyCon == 0&&$('#paste').hasClass('copyfile')){
                var arr=copyfileId+','+$('.tree-node-selected').attr('node-id')

                $.ajax({
                    url:'/newFilePri/copyFolder',
                    dataType:'json',
                    type:'get',
                    data:{
                        sortId:arr,
                        state:state
                    },
                    success:function(res){
                        if(res.flag){
                            $.layerMsg({content:'粘贴成功',icon:1});
                            // reloadTree1();
                        }else{
                            $.layerMsg({content:'粘贴失败',icon:1})
                        }
                    }
                })
            }else{
                var tId=$('#copyAndShear').attr('sortId');
                var sortId=$('.tree-node-selected').attr('node-id');
                var idea=$('input[name="folderId"]').attr('ireader');
                if(tId == '1'){
                    if(copyIds == ''){
                        $.layerMsg({content:'请选择文件！',icon:2});
                    }else{
                        data={
                            witchSortId:sortId,
                            copyId:copyIds,
                            sortType:'5'
                        }
                        copyData('/newFileContent/copyAndParse',data,sortId,idea);
                    }

                }else if(tId == '2'){
                    if(fileIds == ''){
                        $.layerMsg({content:'请选择文件！',icon:2});
                    }else{
                        data={
                            sortId:sortId,
                            contentId:fileIds,
                            sortType:'5',
                            orgSortId:orgSortId
                        }
                        copyData('/newFileContent/fileCut',data,sortId,idea);
                    }
                }else{
                    $.layerMsg({content:'请选择文件！',icon:2});
                }
            }

        })
        //签阅点击事件
        $('#singReading').click(function(){
            if($('#singReading').hasClass('addBackground')){
                return false
            }
            var sortId=$('.tree-node-selected').attr('node-id');
            var idea=$('input[name="folderId"]').attr('ireader');

            var fileId='';
            $(".checkChild:checkbox:checked").each(function(){
                fileId+=$(this).attr("conid")+',';
            })

            if(fileId.length == 0){
                $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:2});
            }else {
                $.ajax({
                    type:'post',
                    url:'/newFileContent/readFile',
                    dataType:'json',
                    data:{'contentId':fileId},
                    success:function(res){
                        if(res.flag){
                            init(sortId,idea);
                        }else{
                            $.layerMsg({content:'签阅失败！',icon:2});
                        }
                    }
                })
            }
        })
        //下载点击事件
        $('.FiveOne').click(function(){
            var text=$('input[name="sortTxt"]').val();
            var fileId=[];
            $(".checkChild:checkbox:checked").each(function(){
                var conId=$(this).attr("conId");
                fileId.push(conId);
            })
            if(fileId == ''){
                $.layerMsg({content:'<fmt:message code="file.th.PleaseSelectFile"/>！',icon:1});
                return false;
            }else{
                window.location.href='../file/downFileContent?contentId='+fileId+'&sortName='+text;
            }
        })
        //
        $('#TitleOne').click(function(e){
            e.stopPropagation();
            var pid=$('input[name="paid"]').val();
            $('#classA').toggle();
            if(pid == 0){
                $('.second').hide();
            }else{
                $('.second').show();
            }
        })
        $(document).on('click',function(){
            if($('#classA').css('display')=='block'){
                $('#classA').css('display','none');
            }
        })
        //新建子文件夹页面显示
        $('#newChild').click(function(){
            $('.newAddFolder').show().siblings().hide();
            $('input[name="polderName"]').focus();
        })
        //新建子文件夹页面确定按钮
        $('#btnSure').click(function(){
            var sortParent=$('input[name="folderId"]').val();
            var idea=$('input[name="folderId"]').attr('ireader');
            var editData=$('input[name="folderId"]').attr('editdata');
            if($('input[name="polderName"]').val() != ''){
                var data={
                    'sortType':5,
                    'sortParent':sortParent,
                    'sortNo':$('input[name="serial"]').val(),
                    'sortName':$('input[name="polderName"]').val()
                }
                if($('input[name="serial"]').val() == '' || $('input[name="polderName"]').val() == ''){
                    $.layerMsg({content:'<fmt:message code="doc.th.sortNumber"/>！',icon:2});
                    return false;
                }
                if (isNaN($('input[name="serial"]').val())) {
                    $.layerMsg({content:'<fmt:message code="doc.th.number"/>！',icon:2});
                    $('input[name="serial"]').focus();
                    return false;
                }
                $.ajax({
                    type:'post',
                    url:'/newFilePub/addPubSort',
                    dataType:'json',
                    data:data,
                    success:function(res){
                        if(res.flag){
                            $.layerMsg({content:'<fmt:message code="depatement.th.Newsuccessfully"/>！',icon:1},function(){
//                        $('input[name="serial"]').val('');
                                $('input[name="polderName"]').val('');
                                $('.mainContent').show();
                                $('.newAddFolder').hide();
                                init(sortParent,idea,editData);
                                // reloadTree1();
                            });
                        }else {
                            $.layerMsg({content:'<fmt:message code="depatement.th.Newfailed"/>！',icon:2});
                        }
                    }
                })
            }else{
                alert('文件夹名称不得为空！')
            }
        })

        /*------------------------------------------------------------------*/
        //查询列表删除
        function dataDeleteOne(fileId,sortId,id){
            layer.confirm('<fmt:message code="sup.th.Delete"/>？', {
                btn: ['<fmt:message code="global.lang.ok"/>','<fmt:message code="depatement.th.quxiao"/>'], //按钮
                title:"<fmt:message code="notice.th.DeleteFile"/>"
            }, function(){
                //确定删除，调接口
                $.ajax({
                    type:'post',
                    url:'/newFileContent/batchDeleteConId',
                    dataType:'json',
                    data:{'fileId':fileId},
                    success:function(){
                        layer.msg('<fmt:message code="workflow.th.delsucess"/>', { icon:6});
                        queryOneData(sortId,id);
                    }
                })

            }, function(){
                layer.closeAll();
            });
        }
        //查询列表方法
        function queryOneData(sortId,id,iReder){
            var ajaxPage={
                data:{
                    'sortId':sortId,
                    'pageNo':0,
                    'pageSize':10,
                    'subjectName':$('input[name="subjectName"]').val(),
                    'contentNo':$('input[name="contentNo"]').val(),
                    'creater':id,
                    'contentValue1':$('input[name="contentValue1"]').val(),
                    'contentValue2':$('input[name="contentValue2"]').val(),
                    'contentValue3':$('input[name="contentValue3"]').val(),
                    'atiachmentDesc':$('input[name="atiachmentDesc"]').val(),
                    'atiachmentName':$('input[name="atiachmentName"]').val(),
                    'atiachmentCont':$('input[name="atiachmentCont"]').val(),
                    'crStartDate':$('input[name="crStartDate"]').val(),
                    'crEndDate':$('input[name="crEndDate"]').val(),
                    'sortType':'5'
                },
                page:function () {
                    var me=this;
                    $.ajax({
                        type:'post',
                        url:'/newFileContent/queryFile',
                        dataType:'json',
                        data:me.data,
                        success:function(res){
                            $('#file_Tachrs').find('tr').remove();
                            var data1=res.datas;
                            var str = '';
                            var files = '';
                            var downUser=$('input[name="down-user"]').val();
                            for(var i=0;i<data1.length;i++){
                                var arr=data1[i].attachmentList;
                                if(data1[i].attachmentList!='' && data1[i].attachmentList!= undefined){
                                    str+="  <tr class='contentTrs' sortId='"+data1[i].sortId+"' contentId='"+data1[i].contentId+"' conType='2'><td><input class='checkChildren' type='checkbox' conId='"+data1[i].contentId+"' name='check' value='' > <a class='TITLE' style='color:#54b6fe;display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;' href='javascript:;'>"+data1[i].subject+ "  </a></td>  <td>"+attachView(arr,'','3',$('input[name="editQuanxian"]').val(),$('input[name="exportQuanxian"]').val(),'0')+"</td> <td> "+data1[i].sendTime+ "  </td><td> "+data1[i].contentNo+ "  </td><td><a href='javascript:;' class='editBtn'><fmt:message code="global.lang.edit"/></a>";
                                    if(iReder == '1'){
                                        str+="<a href='javascript:;' class='signReading'><fmt:message code="meet.th.ReadingStatus"/></a>"
                                    }
                                    str+="</td></tr>"
                                }else{
                                    str+="  <tr class='contentTrs' sortId='"+data1[i].sortId+"' contentId='"+data1[i].contentId+"' conType='2'><td><input class='checkChildren' type='checkbox' conId='"+data1[i].contentId+"' name='check' value='' > <a class='TITLE'  style='color:#54b6fe;display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;' href='javascript:;'>"+data1[i].subject+ "  </a></td>  <td></td> <td> "+data1[i].sendTime+ "  </td><td> "+data1[i].contentNo+ "  </td><td><a href='javascript:;' class='editBtn'><fmt:message code="global.lang.edit"/></a>";
                                    if(iReder == '1'){
                                        str+="<a href='javascript:;' class='signReading'><fmt:message code="meet.th.ReadingStatus"/></a>"
                                    }
                                    str+="</td></tr>"
                                }
                            }
                            $('#file_Tachrs').html(str);
                            me.pageTwo(res.total,me.data.pageSize,me.data.page)
                            $(".contentTrs").click(function () {
                                var state=$(this).find('.checkChildren').prop("checked");
                                if(state==true){
                                    $(this).find('.checkChildren').prop("checked",true);
                                    $(this).addClass('bgcolor');
                                    $('#queryDelete').removeClass('addBackground');
                                }else{
                                    $('#checkedAlls').prop("checked",false);
                                    $(this).find('.checkChildren').prop("checked",false);
                                    $(this).removeClass('bgcolor');
                                    $('#queryDelete').addClass('addBackground');
                                }
                                var child =   $(".checkChildren");
                                for(var i=0;i<child.length;i++){
                                    var childstate= $(child[i]).prop("checked");
                                    if(state!=childstate){
                                        return
                                    }
                                }
                                $('#checkedAlls').prop("checked",state);
                            })
                            $('#queryDelete').addClass('addBackground');

                            $('#checkedAlls').prop("checked",false);
                        }
                    })

                },
                pageTwo:function (totalData, pageSize,indexs) {
                    var mes=this;
                    $('#dbgz_pages').pagination({
                        totalData: totalData,
                        showData: pageSize,
                        jump: true,
                        coping: true,
                        homePage:'',
                        endPage: '',
                        current:indexs||1,
                        callback: function (index) {
                            mes.data.page=index.getCurrent();
                            mes.page();
                        }
                    });
                }
            }
            ajaxPage.page();
        }
        /*-----------------------------------------------------------------------------------*/
        //全局搜索删除列表
        function dataDeleteAll(fileId,id){
            layer.confirm('<fmt:message code="sup.th.Delete"/>？', {
                btn: ['<fmt:message code="global.lang.ok"/>','<fmt:message code="depatement.th.quxiao"/>'], //按钮
                title:"<fmt:message code="notice.th.DeleteFile"/>"
            }, function(){
                //确定删除，调接口
                $.ajax({
                    type:'post',
                    url:'/newFileContent/batchDeleteConId',
                    dataType:'json',
                    data:{'fileId':fileId},
                    success:function(){
                        layer.msg('<fmt:message code="workflow.th.delsucess"/>', { icon:6});
                        sortId='';
                        queryAllData(id);
                    }
                })

            }, function(){
                layer.closeAll();
            });

        }
        //全局搜索列表方法
        function queryAllData(id){
            var ajaxPage={
                data:{
                    contentId:contentId,
                    sortType:'5',
                    page:1,
                    pageSize:10,
                    useFlag:true,
                    'serachType':'2',
                    'subject':$('input[name="subject"]').val(),
                    'sort_no':$('input[name="sort_no"]').val(),
                    'creater':id,
                    'keyword1':$('input[name="keyword1"]').val(),
                    'keyword2':$('input[name="keyword2"]').val(),
                    'keyword3':$('input[name="keyword3"]').val(),
                    'attScript':$('input[name="attScript"]').val(),
                    'attName':$('input[name="attName"]').val(),
                    'attContain':$('input[name="attContain"]').val(),
                    'begainTime':$('input[name="begainTime"]').val(),
                    'endTime':$('input[name="endTime"]').val(),
                },
                page:function () {
                    var me=this;
                    $.ajax({
                        type:'post',
                        url:'/newFileContent/serachAll',
                        dataType:'json',
                        data:me.data,
                        success:function(res){
                            $('#file_Tach').find('tr').remove();
                            var data1=res.obj;
                            var str='';
                            var arr=new Array();
                            for(var i=0;i<data1.length;i++){
                                var stra='';
                                arr=data1[i].attachmentList;
                                if(data1[i].attachmentName!=''){
                                    for(var j=0;j<arr.length;j++){

                                        var iconType='';
                                        if(GetFileExt(arr[j].attachName) == '.docx' || GetFileExt(arr[j].attachName) == '.doc' || GetFileExt(arr[j].attachName) == '.DOC' || GetFileExt(arr[j].attachName) == '.DOCX' || GetFileExt(arr[j].attachName) == '.word' || GetFileExt(arr[j].attachName) == '.WORD'){
                                            iconType='word';
                                        }else if(GetFileExt(arr[j].attachName) == '.pptx' || GetFileExt(arr[j].attachName) == '.ppt'){
                                            iconType='ppt';
                                        }else if(GetFileExt(arr[j].attachName) == '.xlsx' || GetFileExt(arr[j].attachName) == '.xls'){
                                            iconType='excel';
                                        }else if(GetFileExt(arr[j].attachName) == '.pdf'){
                                            iconType='pdf';
//                                            iconType=GetFileExt(arr[j].attachName).replace('.', "")
                                        }else if(GetFileExt(arr[j].attachName) == '.exe'){
                                            iconType='exe';
                                        }else if(GetFileExt(arr[j].attachName) == '.jpg' || GetFileExt(arr[j].attachName) == '.png'){
                                            iconType='pic';
                                        }else if(GetFileExt(arr[j].attachName) == '.rar' || GetFileExt(arr[j].attachName) == '.zip'){
                                            iconType='zip';
                                        }else {
                                            iconType='file';
                                        }

                                        var attUrl_s = arr[j].attUrl;

                                        var attName = encodeURI(arr[j].attachName).replace(/\+/g, "%2b").replace(/\@/g,"%40").replace(/\#/g,"%23").replace(/\&/g,"%26");

                                        attUrl_s = attUrl_s.substring(0,attUrl_s.lastIndexOf("ATTACHMENT_NAME="))+"ATTACHMENT_NAME="+attName;
                                        if($('input[name="exportQuanxian"]').val() == '0'){
                                            stra+='<a href="javascript:void(0);" style="display:block;"><img style="width:18px;height:22px;margin-right:5px;" src="../img/attachmentIcon/'+iconType+'.png"/>'+arr[j].attachName+'</a>';

                                        }else{
                                            stra+='<a href="<%=basePath %>download?'+encodeURI(attUrl_s)+'" style="display:block;"><img style="width:18px;height:22px;margin-right:5px;" src="../img/attachmentIcon/'+iconType+'.png"/>'+arr[j].attachName+'</a>';

                                        }
                                    }
                                    str+='<tr class="contentT" sortId="'+data1[i].sortId+'" contentId="'+data1[i].contentId+'" conType="3"><td><input class="checkChildren" conId="'+data1[i].contentId+'" type="checkbox" name="check" value="" style="margin-right:15px;" >'+data1[i].filePath+'</td><td><a class="TITLE" href="javascript:;"  style="color:#54b6fe;display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">'+data1[i].subject+'</a></td><td>'+stra+'</td><td>'+function () {
                                        if(data1[i].attachmentDesc != undefined){
                                            return data1[i].attachmentDesc;
                                        }else {
                                            return '';
                                        }
                                    }()+'</td><td>'+data1[i].sendTime+'</td><td>';
                                    if(data1[i].mapPriv.MANAGE_USER == 1){
                                        str+='<a href="javascript:;" class="editBtn"><fmt:message code="global.lang.edit"/></a>';
                                    }
                                    if(data1[i].mapPriv.SIGN_USER == 1){
                                        str+='<a href="javascript:;" class="signReading"><fmt:message code="meet.th.ReadingStatus"/></a>';
                                    }
                                    str+='</td></tr>';
                                }else {
                                    str+='<tr class="contentT" sortId="'+data1[i].sortId+'" contentId="'+data1[i].contentId+'" conType="3"><td><input class="checkChildren" conId="'+data1[i].contentId+'" type="checkbox" name="check" value="" style="margin-right:15px;" >'+data1[i].filePath+'</td><td><a class="TITLE" href="javascript:;"   style="color:#54b6fe;display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">'+data1[i].subject+'</a></td><td></td><td>'+function () {
                                        if(data1[i].attachmentDesc != undefined){
                                            return data1[i].attachmentDesc;
                                        } else{
                                            return '';
                                        }
                                    }()+'</td><td>'+data1[i].sendTime+'</td><td>';
                                    if(data1[i].mapPriv.MANAGE_USER == 1){
                                        str+='<a href="javascript:;" class="editBtn"><fmt:message code="global.lang.edit"/></a>';
                                    }
                                    if(data1[i].mapPriv.SIGN_USER == 1){
                                        str+='<a href="javascript:;" class="signReading"><fmt:message code="meet.th.ReadingStatus"/></a>';
                                    }
                                    str+='</td></tr>';
                                }
                            }
                            $('#file_Tach').html(str);
                            me.pageTwo(res.totleNum,me.data.pageSize,me.data.page)
                            $(".contentT").click(function () {
                                var state=$(this).find('.checkChildren').prop("checked");
                                if(state==true){
                                    $(this).find('.checkChildren').prop("checked",true);
                                    $(this).addClass('bgcolor');
                                }else{
                                    $('#checkedAllY').prop("checked",false);
                                    $(this).find('.checkChildren').prop("checked",false);
                                    $(this).removeClass('bgcolor');
                                }
                                if($('#file_Tach .checkChildren:checked').length != 0){
                                    $('#deleteAll').removeClass('addBackground');
                                }else{
                                    $('#deleteAll').addClass('addBackground');
                                }
                                var child =   $(".checkChildren");
                                for(var i=0;i<child.length;i++){
                                    var childstate= $(child[i]).prop("checked");
                                    if(state!=childstate){
                                        return
                                    }
                                }
                                $('#checkedAllY').prop("checked",state);
                            })
                            $('#deleteAll').addClass('addBackground');

                            $('#checkedAllY').prop("checked",false);
                        }
                    })
                },
                pageTwo:function (totalData, pageSize,indexs) {
                    var mes=this;
                    $('#dbgz_pagesd').pagination({
                        totalData: totalData,
                        showData: pageSize,
                        jump: true,
                        coping: true,
                        homePage:'',
                        endPage: '',
                        current:indexs||1,
                        callback: function (index) {
                            mes.data.page=index.getCurrent();
                            mes.page();
                        }
                    });
                }
            }
            ajaxPage.page();
        }
        /*-------------------------------------------------------------------------------*/

        //新建子文件夹页面返回按钮
        $('#btnBack').click(function(){
//        $('input[name="serial"]').val('');
            $('input[name="polderName"]').val('');
            $('.mainContent').show();
            $('.newAddFolder').hide();
        })
        //编辑页面显示
        $('#editFile').click(function(){
            $('.editAddFolder').show().siblings().hide();
            var sortId=$('input[name="folderId"]').val();
            $.ajax({
                type:'get',
                url:'../file/fileGetOne',
                dataType:'json',
                data:{'sortId':sortId},
                success:function(res){
                    var data=res.object;
                    $('input[name="edSerial"]').val('');
                    $('input[name="edPolderName"]').val('');

                    $('input[name="edSerial"]').val(data.sortNo);
                    $('input[name="edPolderName"]').val(data.sortName);
                }
            })
        })
        //编辑页面确定按钮
        $('#editSure').click(function(){
            var sortId=$('input[name="folderId"]').val();
            var idea=$('input[name="folderId"]').attr('ireader');
            var editData=$('input[name="folderId"]').attr('editdata');
            if($('input[name="edPolderName"]').val() == ''){
                alert('文件夹名称不得为空！');
            }else{
                var data={
                    'sortId':sortId,
                    'sortNo':$('input[name="edSerial"]').val(),
                    'sortName':$('input[name="edPolderName"]').val()
                }
                $.ajax({
                    type:'post',
                    url:'/newFilePub/updPubSort',
                    dataType:'json',
                    data:data,
                    success:function(res){
                        if(res.flag){
                            $.layerMsg({content:'<fmt:message code="depatement.th.Modifysuccessfully"/>！',icon:1},function(){
                                $('.editAddFolder').hide();
                                $('.mainContent').show();
                                init(sortId,idea,editData);
                                // reloadTree1();
                            });
                        }else{
                            $.layerMsg({content:'<fmt:message code="depatement.th.modifyfailed"/>！',icon:2},function(){
                                console.log('<fmt:message code="depatement.th.modifyfailed"/>')
                            });
                        }
                    }
                })
            }
        })
        //设置权限按钮
        $('#setting').click(function(){
            var sortId=$('.tree-node-selected').attr('node-id');
            $.popWindow('/newFilePub/tempHome?sortId='+sortId+'','<fmt:message code="netdisk.th.PermissionSetting"/>','0','0','1500px','800px');
        })
        //编辑页面返回按钮
        $('#editBack').click(function(){
            $('input[name="edSerial"]').val('');
            $('input[name="edPolderName"]').val('');
            $('.editAddFolder').hide();
            $('.mainContent').show();
        })
        //删除子文件夹按钮
        $('#deleteFile').click(function(){
            var sortId=$('input[name="folderId"]').val();
            var idea=$('input[name="folderId"]').attr('ireader');
            var editData=$('input[name="folderId"]').attr('editdata');
            layer.confirm('<fmt:message code="sys.th.commit"/>！', {
                btn: ['<fmt:message code="global.lang.ok"/>','<fmt:message code="depatement.th.quxiao"/>'], //按钮
                title:"<fmt:message code="notice.th.DeleteFile"/>"
            }, function(){
                //确定删除，调接口
                $.ajax({
                    type:'post',
                    url:'/newFilePub/delPubSort',
                    dataType:'json',
                    data:{'sortId':sortId},
                    success:function(res){
                        if(res.flag == true){
                            layer.msg('<fmt:message code="workflow.th.delsucess"/>', { icon:6});
                            init(1,idea,editData);
                            // reloadTree1();
                        }else{
                            layer.msg('<fmt:message code="lang.th.deleSucess"/>', { icon:5});
                        }
                    }
                });

            }, function(){
                layer.closeAll();
            });
        })
        var user_id='dePsenduser';
        $(function(){
            //选人控件
            $("#selectUserDep").on("click",function(){
                user_id='dePsenduser';
                $.popWindow("../common/selectUser");
            });
            //清空所选人员
            $('.clear').click(function(){
                $('#dePsenduser').val('');
                $('#dePsenduser').attr('user_id','');
            })

            $('#uploadinputimg').change(function(){
                var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
                var isOpera = userAgent.indexOf("Opera") > -1;
                $(".attach").show();
                if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera){
                    //alert(111);
                    var src = $(this).target || window.event.srcElement; //获取事件源，兼容chrome/IE
                    var filename = src.value;
                    var str = filename.substring(filename.lastIndexOf('\\') + 1);
                    $('.box').html(str);
                }else{
                    var arr=$(this)[0].files;
                    var length = arr.length;
                    var str='';
                    //alert(arr);
                    //alert(length);
                    for(var i=0;i<arr.length;i++){
                        str+='<p>'+arr[i].name+'</p>';
                    }
                    $('.box').html(str);
                }

            })


            $('#start').click(function(){
                var index = layer.load(3, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
                var sortId=$('[name="sortId"]').val();
                var idea=$('input[name="folderId"]').attr('ireader');
                var editData=$('input[name="folderId"]').attr('editdata');
                var remindVal=0;
                if($('.remindCheck').is(":checked")){
                    remindVal=1;
                }
                var smsDefault =1;
                if($('.smsDefault').is(":checked")){
                    smsDefault=0;
                }
                $('#uploadimgform').ajaxSubmit({
                    dataType:'json',
                    data:{
                        sortType:'5',
                        remind:remindVal,//事务提醒
                        smsDefault:smsDefault //手机提醒
                    },
                    success:function (res) {
                        if(res.status == true){
                            $('.box').children().remove();
                            $('.attach').hide();
                            init(sortId,idea,editData);
                            layer.close(index);
                        }else {
                            if(res.msg == 'notEnough'){
                                layer.msg('文件夹容量不足！', {icon: 2});
                                $('.box').children().remove();
                                $('.attach').hide();
                                layer.close(index);
                            }else{
                                layer.msg('上传失败！'+res.msg+'个空文件未上传', {icon: 2});
                                $('.box').children().remove();
                                $('.attach').hide();
                                layer.close(index);
                            }
                        }
                    }
                })
            })

//       文件编辑
            $("#file_Tachr").on('click','.editBoxBtn',function(){
                var idT=$(this).parents('tr').attr('contentId');
                var sortId=$(this).parents('tr').attr('sortId');
                <%--$.popWindow('<%=basePath%>file/contentAdd?contentId='+idT+'&sortId='+sortId,'编辑','100','300','860px','500px');--%>
                var contype=$(this).parents('tr').attr('conType');
                var idea=$('input[name="folderId"]').attr('ireader');
                $.popWindow('/newFilePub/newFiles?contentId='+idT+'&sortId='+sortId+'&contype='+contype+'&idea='+idea+'&ie_open=yes','<fmt:message code="global.lang.edit"/>','0','0','1500px','800px');
            })

            //全部取消点击事件
            $('.cancle').click(function(){
                $('.box').children().remove();
                $('.attach').hide();
            })

        })

        function TreeNode(id,text,state,children){
            this.id = id;
            this.text = text;
            this.state = state;
            this.children = children;
        }

        function convert1(data){
            var arr = [];
            data.forEach(function(v,i){
                if(v.sortName){
                    var node = new TreeNode(v.sortId,v.sortName,"closed")
                    arr.push(node);
                }
            });
            return arr;
        }

        function copyData(url,data,sortId,iReader,editdatas){
//        var sortId=$('.tree-node-selected').attr('node-id');
            $.ajax({
                type:'post',
                url:url,
                dataType:'json',
                data:data,
                success:function(res){
                    if(res.flag==true){
                        $.layerMsg({content:'<fmt:message code="file.th.PasteSuccessfully"/>！',icon:1},function(){
                            init(sortId,iReader,editdatas);
                        });
                    }else{
                        if(res.msg == 'notEnough'){
                            layer.msg('文件夹容量不足！', {icon: 2});
                        }else{
                            layer.msg('粘贴失败！', {icon: 2});
                        }
                    }
                }
            })
        }

        function dataDelete(fileId,id,iReader,editdatas){
            layer.confirm('<fmt:message code="sup.th.Delete"/>？', {
                btn: ['<fmt:message code="global.lang.ok"/>','<fmt:message code="depatement.th.quxiao"/>'], //按钮
                title:"<fmt:message code="notice.th.DeleteFile"/>"
            }, function(){
                //确定删除，调接口
                $.ajax({
                    type:'post',
                    url:'/newFileContent/batchDeleteConId',
                    dataType:'json',
                    data:{
                        'fileId':fileId,
                        sortType:'5'
                    },
                    success:function(){
                        layer.msg('<fmt:message code="workflow.th.delsucess"/>', { icon:6});
                        init(id,iReader,editdatas);
                    }
                })

            }, function(){
                layer.closeAll();
            });

        }
        
        // 查看新闻内容
        $(document).on('click', '.edit_news_content', function(){
            var newsId = $(this).attr('newsid');
            layer.open({
                type: 1,
                title: '新闻内容',
                area: ['100%', '100%'],
                content: '<div style="width: 100%; height: 100%;overflow-y: auto;"><style>#newsContent p {margin: 14px 0;font-size: 14px;color: #444;line-height: 25px;}</style><div id="newsContent" style="width: 100%;"></div></div>',
                success: function () {
                    $.get('/news/getOneById', {newsId: newsId, changId: "1"}, function (res) {
                        if (res.flag) {
                            $('#newsContent').html(res.object.content);
                        }
                    });
                }
            });
        });
    });
    
    // 文件批量下载
    $.dynamicSubmit = function (url, datas, fn) {
        var form = $('#dynamicForm');
        if (form.length <= 0) {
            form = $("<form>");
            form.attr('id', 'dynamicForm');
            form.attr('style', 'display:none');
            form.attr('target', '');
            form.attr('method', 'post');
            $('body').append(form);
        }
        form = $('#dynamicForm');
        form.attr('action', url);
        form.empty();
        if (datas && typeof (datas) == 'object') {
            for (var item in datas) {
                var $_input = $('<input>');
                $_input.attr('type', 'hidden');
                $_input.attr('name', item);
                $_input.val(datas[item]);
                $_input.appendTo(form);
            }
        }
        form.submit();
        // form.remove();
        if (fn) {
            fn();
        }
    };
    
</script>
